diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 6ab0d0203..258bf1309 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -30,10 +30,10 @@ jobs: - name: Install dependencies run: | pip install -U pip - pip install tox flake8 + pip install tox ruff - - name: flake8 critical lint - run: tox -e flake8-critical + - name: ruff critical lint + run: tox -e ruff-critical test: needs: lint diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ed781ce56..541389f4a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,12 +7,16 @@ repos: - id: end-of-file-fixer exclude: &exclude_pattern '^changelog.d/' - id: debug-statements -- repo: https://github.com/pycqa/flake8 - rev: 7.1.1 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.6.9 hooks: - - id: flake8 - name: "Flake8: critical" - args: ['--count', '--select=E9,F63,F7,F82', '--show-source', '--statistics'] + - id: ruff + name: "Ruff: critical" + args: [ + '--select=E9,F63,F7,F82', + '--output-format=full', + '--statistics' + ] types: [file, python] - repo: https://github.com/psf/black rev: 24.8.0 diff --git a/pyproject.toml b/pyproject.toml index 2e948b5ad..bf0aa7deb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ dev = [ "black", "coverage", "django-extensions", - "flake8", + "ruff", "ipython", "pre-commit", "python-dotenv", @@ -107,6 +107,14 @@ exclude = ''' ) ''' +[tool.ruff] +line-length = 120 +extend-exclude = [ + ".egg-info", + "migrations", + "templates", +] + [tool.towncrier] directory = "changelog.d" filename = "CHANGELOG.md" diff --git a/tox.ini b/tox.ini index eeafb671b..2dc4bb456 100644 --- a/tox.ini +++ b/tox.ini @@ -31,14 +31,13 @@ commands = -coverage combine --append coverage html --include="./src/*" --omit="*/admin.py,*/test*,*/migrations/*" -[testenv:flake8-critical] +[testenv:ruff-critical] setenv = -basepython = python3.10 deps = - flake8 + ruff commands = # stop the build if there are Python syntax errors or undefined names - flake8 --count --select=E9,F63,F7,F82 --show-source --statistics src/ + ruff check --output-format=full --select=E9,F63,F7,F82 --statistics src/ [testenv:upgrade-deps] whitelist_externals = cp @@ -95,12 +94,3 @@ omit = exclude_lines = # Ignore not abstract methods, as these cannot be tested raise NotImplementedError - -[flake8] -max-line-length = 88 -filename = - src/**/*.py -extend_exclude = - *.egg-info, - migrations, - templates