Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ruff instead of flake8 to find syntax errors #905

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dev = [
"black",
"coverage",
"django-extensions",
"flake8",
"ruff",
"ipython",
"pre-commit",
"python-dotenv",
Expand Down Expand Up @@ -107,6 +107,14 @@ exclude = '''
)
'''

[tool.ruff]
line-length = 120
extend-exclude = [
".egg-info",
"migrations",
"templates",
]

[tool.towncrier]
directory = "changelog.d"
filename = "CHANGELOG.md"
Expand Down
16 changes: 3 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Loading