replace flake8 with ruff

This commit is contained in:
Changaco 2024-04-28 18:39:50 +02:00
parent 10d7cfeaf0
commit 28cfc4b66c
8 changed files with 25 additions and 19 deletions

View File

@ -1,4 +0,0 @@
[flake8]
ignore = E127,E226,E301,E302,E303,E305,E306,E309,E402,E701,E711,E712,E731,E741,W504
max_line_length = 120
show_source = True

View File

@ -66,25 +66,25 @@ test-shell: $(env)
test-schema: $(env)
$(with_tests_env) ./recreate-schema.sh test
pyflakes: $(env)
$(env_py) -m flake8 app.py liberapay tests
lint: $(env)
$(env_py) -m ruff check app.py liberapay tests
test: test-schema pytest
tests: test
pytest: $(env)
$(py_test) ./tests/py/test_$${PYTEST-*}.py
@$(MAKE) --no-print-directory pyflakes
@$(MAKE) --no-print-directory lint
$(py_test) --doctest-modules liberapay
pytest-cov: $(env)
$(py_test) --cov-report html --cov liberapay ./tests/py/test_$${PYTEST-*}.py
@$(MAKE) --no-print-directory pyflakes
@$(MAKE) --no-print-directory lint
$(py_test) --doctest-modules liberapay
pytest-re: $(env)
$(py_test) --lf ./tests/py/
@$(MAKE) --no-print-directory pyflakes
@$(MAKE) --no-print-directory lint
pytest-i18n-browse: $(env)
@if [ -f sql/branch.sql ]; then $(MAKE) --no-print-directory test-schema; fi

View File

@ -2863,7 +2863,7 @@ class Participant(Model, MixinTeam):
for naive_group in naive_groups:
naive_group.sort(key=due_date_getter)
group = None
execution_date = weeks_until_execution = None # for flake8
execution_date = weeks_until_execution = None # for the linter
for tip in naive_group:
last_payment_amount = last_payment_amounts.get(tip.tippee)
# Start a new group if…

View File

@ -1,4 +1,4 @@
# flake8: noqa
# ruff: noqa
"""
Examples of data returned by the APIs of the elsewhere platforms.

View File

@ -241,7 +241,7 @@ def iter_payday_events(db, participant, period_start, period_end, today, minimiz
prev_date = None
get_timestamp = lambda e: e['timestamp']
events = sorted(exchanges+transfers, key=get_timestamp, reverse=True)
day_events, day_open = None, None # for pyflakes
day_events, day_open = None, None # for the linter
for event in events:
collapse = False

10
pyproject.toml Normal file
View File

@ -0,0 +1,10 @@
[tool.ruff]
# https://docs.astral.sh/ruff/configuration/
line-length = 120
output-format = "full"
[tool.ruff.lint]
ignore = [
"E226", "E301", "E302", "E303", "E305", "E306", "E402",
"E701", "E711", "E712", "E721", "E731", "E741",
]

View File

@ -1,8 +1,8 @@
pytest
pytest-cov
pytest-cache
pytest-profiling
flake8
vcrpy
Faker
html5lib
pytest
pytest-cache
pytest-cov
pytest-profiling
ruff
vcrpy

View File

@ -7,7 +7,7 @@ commands =
pip install -q -r requirements_base.txt
pip install -q -r requirements_tests.txt
python cli/run.py -e defaults.env,tests/test.env,tests/local.env python -m pytest -Wd --cov liberapay --cov-report lcov tests/py {posargs}
flake8 app.py liberapay tests
ruff check app.py liberapay tests
python cli/run.py -e defaults.env,tests/test.env,tests/local.env python -m pytest --doctest-modules liberapay
passenv =
LIBERAPAY_I18N_TEST