Skip to content

Commit

Permalink
Replace flake8 + isort + bandit with ruff
Browse files Browse the repository at this point in the history
Signed-off-by: Aarni Koskela <[email protected]>
  • Loading branch information
akx committed Dec 21, 2023
1 parent a2d01de commit 70f5a74
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[tool.ruff]
line-length = 167

ignore = [
"E402", # TODO: enable
"E711", # TODO: enable
"E711", # TODO: enable
"E712", # TODO: enable
"E721", # TODO: enable
"S101", # TODO: enable
"S110", # TODO: enable
"S324", # TODO: enable
]
extend-select = [
"S", # Bandit
"E9",
"F63",
"F7",
"F82",
"I",
]

[tool.ruff.per-file-ignores]
"{test,tests,examples}/**/*.py" = [
"E741",
"F401",
"F811",
"F841",
"I",
"S",
]
28 changes: 4 additions & 24 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,26 @@ envlist = py{37,38,39}
whitelist_externals = echo make
deps =
-rrequirements.txt
flake8
ruff==0.1.8
allowlist_externals =
echo
make
commands =
# $EXCLUDE is defined above in testenv:py27 as a workaround for Python 2
# which does not support asyncio and type hints
flake8 . --count --select=E9,F63,F7,F822,F823 --show-source --statistics {env:EXCLUDE:}
ruff .
python setup.py test
make -C test test
# TODO (cclauss) Fix up all these undefined names
flake8 . --count --exit-zero --select=F821 --show-source --statistics

# On older Python, flake8 version 4 fail with:
# RecursionError: maximum recursion depth exceeded
[testenv:py37]
deps =
-rrequirements.txt
flake8<4

# This lint environment should be the same as the one in .github/work
[testenv:lint]
deps =
bandit
-e .
black
codespell
flake8
isort
mypy
pytest
pyupgrade
ruff==0.1.8
safety
-e .
commands =
# The "-" in front of command tells tox to ignore errors
bandit --recursive --skip B101,B105,B106,B110,B303,B404,B603,B324 src
- black --check src
- codespell
flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 src --count --exit-zero --max-complexity=29 --max-line-length=167 --show-source --statistics
isort --check-only --profile black src
- mypy --ignore-missing-imports src
safety check

0 comments on commit 70f5a74

Please sign in to comment.