-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move to ruff from black * add setup.cfg back for pytest
- Loading branch information
1 parent
2e27e66
commit 98b6467
Showing
32 changed files
with
250 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,19 +22,24 @@ jobs: | |
- name: Hassfest validation | ||
uses: "home-assistant/actions/hassfest@master" | ||
|
||
style: | ||
ruff: | ||
name: "Ruff" | ||
runs-on: "ubuntu-latest" | ||
name: Check style formatting | ||
steps: | ||
- uses: "actions/checkout@v4" | ||
- uses: "actions/setup-python@v4" | ||
- uses: isort/[email protected] | ||
- uses: jpetrucciani/black-check@master | ||
- name: "Checkout the repository" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "Set up Python" | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.x" | ||
- run: python3 -m pip install flake8 | ||
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
- run: flake8 . --count --max-complexity=15 --max-line-length=127 --statistics | ||
python-version: "3.11" | ||
cache: "pip" | ||
|
||
- name: "Install requirements" | ||
run: python3 -m pip install -r requirements.txt | ||
|
||
- name: "Run" | ||
run: python3 -m ruff check . | ||
|
||
tests: | ||
runs-on: "ubuntu-latest" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ secrets.yaml | |
blueprints | ||
docs/_build | ||
coverage.xml | ||
.ruff_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml | ||
|
||
target-version = "py310" | ||
|
||
select = [ | ||
"B007", # Loop control variable {name} not used within loop body | ||
"B014", # Exception handler with duplicate exception | ||
"C", # complexity | ||
"D", # docstrings | ||
"E", # pycodestyle | ||
"F", # pyflakes/autoflake | ||
"ICN001", # import concentions; {name} should be imported as {asname} | ||
"PGH004", # Use specific rule codes when using noqa | ||
"PLC0414", # Useless import alias. Import alias does not rename original package. | ||
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass | ||
"SIM117", # Merge with-statements that use the same scope | ||
"SIM118", # Use {key} in {dict} instead of {key} in {dict}.keys() | ||
"SIM201", # Use {left} != {right} instead of not {left} == {right} | ||
"SIM212", # Use {a} if {a} else {b} instead of {b} if not {a} else {a} | ||
"SIM300", # Yoda conditions. Use 'age == 42' instead of '42 == age'. | ||
"SIM401", # Use get from dict with default instead of an if block | ||
"T20", # flake8-print | ||
"TRY004", # Prefer TypeError exception for invalid type | ||
"RUF006", # Store a reference to the return value of asyncio.create_task | ||
"UP", # pyupgrade | ||
"W", # pycodestyle | ||
] | ||
|
||
ignore = [ | ||
"D202", # No blank lines allowed after function docstring | ||
"D203", # 1 blank line required before class docstring | ||
"D213", # Multi-line docstring summary should start at the second line | ||
"D404", # First word of the docstring should not be This | ||
"D406", # Section name should end with a newline | ||
"D407", # Section name underlining | ||
"D411", # Missing blank line before section | ||
"E501", # line too long | ||
"E731", # do not assign a lambda expression, use a def | ||
] | ||
|
||
[flake8-pytest-style] | ||
fixture-parentheses = false | ||
|
||
[pyupgrade] | ||
keep-runtime-typing = true | ||
|
||
[mccabe] | ||
max-complexity = 25 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.black-formatter", | ||
"editor.formatOnSave": true | ||
}, | ||
"python.formatting.provider": "none" | ||
// Please keep this file in sync with settings in home-assistant/.devcontainer/devcontainer.json | ||
// Added --no-cov to work around TypeError: message must be set | ||
// https://github.com/microsoft/vscode-python/issues/14067 | ||
"python.testing.pytestArgs": ["--no-cov"], | ||
// https://code.visualstudio.com/docs/python/testing#_pytest-configuration-settings | ||
"python.testing.pytestEnabled": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.