Skip to content

Commit

Permalink
Update linters and GitHub actions (#306)
Browse files Browse the repository at this point in the history
* Update GitHub Actions
* Implement pre-commit, pyproject, ruff, mypy
* Update code from linters
* Enable McCabe cyclomatic complexity
* Reduce complaxity
* Improve get_attr typing
  • Loading branch information
Snuffy2 authored Jan 9, 2025
1 parent 55f05db commit ebaa894
Show file tree
Hide file tree
Showing 26 changed files with 2,045 additions and 1,796 deletions.
13 changes: 0 additions & 13 deletions .github/issue-branch.yml.old

This file was deleted.

31 changes: 31 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: 1
appendOnly: true
labels:
- label: "bugfix"
title: "(?i).*fix.*"
- label: "bugfix"
branch: "(?i).*fix.*"
- label: "feature"
title: "(?i).*feat.*"
- label: "feature"
branch: "(?i).*feat.*"
- label: "breaking-change"
title: "(?i).*breaking[ -_]change.*"
- label: "breaking-change"
branch: "(?i).*breaking[ -_]change.*"
- label: "github_actions"
title: "(?i).*github[ -_]action.*"
- label: "github_actions"
branch: "(?i).*github[ -_]action.*"
- label: "enhancement"
title: "(?i).*enhance.*"
- label: "enhancement"
branch: "(?i).*enhance.*"
- label: "enhancement"
title: "(?i).*improve.*"
- label: "enhancement"
branch: "(?i).*improve.*"
- label: "chore"
title: "(?i).*chore.*"
- label: "chore"
branch: "(?i).*chore.*"
24 changes: 22 additions & 2 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@ changelog:
exclude:
labels:
- ignore-for-release
- black
- isort
- dependencies
categories:
- title: "💥 Breaking Change 💥"
labels:
- Semver-Major
- breaking-change
- title: "🎉 Enhancements & New Features 🎉"
labels:
- Semver-Minor
- enhancement
- feature
- title: "🕷️ Bug Fixes 🕷️"
labels:
- fix
- bugfix
- bug
- title: "🔧 Maintenance 🔧"
labels:
- chore
- github_actions
- title: Other Changes
labels:
- "*"
45 changes: 0 additions & 45 deletions .github/workflows/branch_action.yml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/empty_commit.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/ha_and_hacs_validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: HA and HACS Validate

on:
push:
pull_request:
workflow_dispatch:

jobs:
ha_validation:
name: Hassfest Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Hassfest validation
uses: home-assistant/actions/hassfest@master
hacs_validation:
name: HACS Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: HACS validation
uses: hacs/action@main
with:
category: integration
18 changes: 0 additions & 18 deletions .github/workflows/hacs_validate.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/workflows/hassfest_validate.yml

This file was deleted.

13 changes: 0 additions & 13 deletions .github/workflows/issue_action.yml.old

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "Pull Request Labeler"
on:
pull_request_target:

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Pull Request Labeler
uses: srvaroa/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
35 changes: 35 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Linters

on:
pull_request:
push:
branches: [main]
workflow_dispatch:

jobs:
linters:
name: Run Linters
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Cache pip dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install requirements
run: pip install -r requirements.txt
- name: Run pre-commit
uses: pre-commit/[email protected]
- name: Run pre-commit.ci
uses: pre-commit-ci/[email protected]
if: always()
- name: Run mypy
run: mypy "./custom_components/places/" --install-types --non-interactive --config-file pyproject.toml
57 changes: 0 additions & 57 deletions .github/workflows/mylint_action.yml.old

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/release_action.yml.old

This file was deleted.

Loading

0 comments on commit ebaa894

Please sign in to comment.