Skip to content

Commit 8f60102

Browse files
committed
Update ruff + fix violations
1 parent 7b3e0d3 commit 8f60102

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

newdle/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def cleanup_newdles(dry_run):
4040
and not final_date_cleanup_days
4141
and not deleted_cleanup_days
4242
):
43-
current_app.logger.warn(
43+
current_app.logger.warning(
4444
'Nothing to do, LAST_ACTIVITY_CLEANUP_DELAY, '
4545
'DELETED_CLEANUP_DELAY and FINAL_DATE_CLEANUP_DELAY are not set.'
4646
)
@@ -65,7 +65,7 @@ def cleanup_newdles(dry_run):
6565
)
6666

6767
for newdle in Newdle.query.filter(and_(*filters) | deleted_filter):
68-
current_app.logger.info(f'Deleting newdle {newdle.code} ({newdle.title})')
68+
current_app.logger.info('Deleting newdle %s (%s)', newdle.code, newdle.title)
6969
db.session.delete(newdle)
7070
if dry_run:
7171
current_app.logger.info(

newdle/core/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _handle_exception(exc):
7777
# default logic which results in standard "internal server error"
7878
# message or the debugger while in development mode.
7979
raise # noqa: PLE0704
80-
app.logger.exception('Request failed')
80+
app.logger.exception('Request failed') # noqa: LOG004
8181
return jsonify(error='internal_error'), 500
8282

8383

requirements.dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pytest-mock==3.14.0
8181
# via -r requirements.dev.in
8282
pytest-snapshot==0.9.0
8383
# via -r requirements.dev.in
84-
ruff==0.4.3
84+
ruff==0.12.9
8585
# via -r requirements.dev.in
8686
six==1.16.0
8787
# via

ruff.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ target-version = 'py312'
44
preview = true
55

66
select = [
7-
'E', # pycodestyle
7+
'E', # pycodestyle (errors)
8+
'W', # pycodestyle (warnings)
89
'F', # pyflakes
910
'N', # pep8-naming
1011
'Q', # flake8-quotes
@@ -15,6 +16,7 @@ select = [
1516
'C4', # flake8-comprehensions
1617
'INT', # flake8-gettext
1718
'LOG', # flake8-logging
19+
'G', # flake8-logging-format
1820
'B', # flake8-bugbear
1921
'A001', # flake8-builtins
2022
'COM', # flake8-commas
@@ -42,6 +44,7 @@ ignore = [
4244
'RUF015', # not always more readable, and we don't do it for huge lists
4345
'RUF022', # autofix messes up our formatting instead of just sorting
4446
'RUF027', # also triggers on i18n functions -> too noisy for now
47+
'RUF052', # we often use underscore-prefixed variables in tests and to cache regexps in function definitions
4548
'UP038', # it looks kind of weird and it slower than a tuple
4649
'D205', # too many docstrings which have no summary line
4750
'D301', # https://github.com/astral-sh/ruff/issues/8696
@@ -59,8 +62,6 @@ ignore = [
5962
'B011', # we don't run python with `-O` (also see S101)
6063
'B904', # possibly useful but too noisy
6164
'PIE807', # `lambda: []` is much clearer for `load_default` in schemas
62-
'PT004', # pretty weird + not a pytest convention: https://github.com/astral-sh/ruff/issues/8796
63-
'PT005', # ^ likewise
6465
'PT011', # very noisy
6566
'PT015', # nice for tests but not so nice elsewhere
6667
'PT018', # ^ likewise
@@ -96,7 +97,7 @@ ignore = [
9697
]
9798

9899
extend-safe-fixes = [
99-
'RUF005', # we typically don't deal with objects overriding `__add__` ir `__radd__`
100+
'RUF005', # we typically don't deal with objects overriding `__add__` or `__radd__`
100101
'C4', # they seem pretty safe
101102
'UP008', # ^ likewise
102103
'D200', # ^ likewise
@@ -142,8 +143,11 @@ classmethod-decorators = [
142143
[lint.pydocstyle]
143144
convention = 'pep257'
144145

146+
[lint.ruff]
147+
parenthesize-tuple-in-subscript = true
148+
145149
[lint.per-file-ignores]
146150
# vendored code - don't care about most stuff in there
147-
'newdle/vendor/*.py' = ['N', 'F841', 'UP', 'D', 'PIE', 'TID252', 'TRY']
151+
'newdle/vendor/*.py' = ['N', 'F841', 'UP', 'D', 'PIE', 'TID252', 'TRY', 'RUF059']
148152
# allow long lines in migrations (only do that for raw SQL please)
149153
'newdle/migrations/versions/*.py' = ['E501', 'D400']

0 commit comments

Comments
 (0)