Skip to content

Commit

Permalink
Use ruff isort plugin instead of isort (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
farmio authored Nov 5, 2023
1 parent 4ceff9b commit 380be02
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
8 changes: 2 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,13 @@ repos:
hooks:
- id: flake8
files: ^(xknxproject|examples|docs)/.+\.py$
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args:
- --resolve-all-configs
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.292'
hooks:
- id: ruff
# in CI it is directly run by tox to allow dependency upgrade checks
stages: [pre-commit]
args: [ --fix, --exit-non-zero-on-fix ]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand Down
13 changes: 5 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,9 @@ version = {attr = "xknxproject.__version__.__version__"}
include = ["xknxproject*"]

[tool.black]
target-version = ["py39", "py310", "py311", "py312"]
exclude = "generated"


[tool.isort]
profile = "black"
# will group `import x` and `from x import` of the same module.
force_sort_within_sections = true
combine_as_imports = true


[tool.mypy]
python_version = "3.9"
strict = true
Expand Down Expand Up @@ -125,6 +117,7 @@ select = [
"D", # pydocstyle
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"RUF", # ruff specific
"T20", # print
"UP", # pyupgrade
Expand All @@ -139,3 +132,7 @@ ignore = [
extend-exclude = [
"script",
]

[tool.ruff.isort]
force-sort-within-sections = true
combine-as-imports = true
1 change: 0 additions & 1 deletion requirements_testing.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
-r requirements_production.txt
pre-commit==3.5.0
isort==5.12.0
flake8==6.1.0
pylint==3.0.2
pytest==7.4.3
Expand Down
9 changes: 6 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py39, py310, py311, py312, typing, lint, pylint
envlist = py39, py310, py311, py312, ruff, typing, lint, pylint
skip_missing_interpreters = True

[testenv]
Expand All @@ -14,12 +14,10 @@ wheel_build_env = .pkg
[testenv:lint]
basepython = python3
commands =
ruff check {posargs:.}
pre-commit run codespell {posargs: --all-files}
pre-commit run flake8 {posargs: --all-files}
pre-commit run pyupgrade {posargs: --all-files}
pre-commit run black {posargs: --all-files}
pre-commit run isort {posargs: --all-files}
pre-commit run check-json {posargs: --all-files}
pre-commit run trailing-whitespace {posargs: --all-files}

Expand All @@ -28,6 +26,11 @@ basepython = python3
commands =
pylint xknxproject

[testenv:ruff]
basepython = python3
commands =
ruff check {posargs:.}

[testenv:typing]
basepython = python3
commands =
Expand Down

0 comments on commit 380be02

Please sign in to comment.