Skip to content

Commit e1658db

Browse files
authored
pyproject.toml: Work on the readability of ruff settings (#1850)
1 parent 3bcae73 commit e1658db

File tree

2 files changed

+26
-45
lines changed

2 files changed

+26
-45
lines changed

debug_toolbar/panels/templates/panel.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,9 @@ def process_context_list(self, context_layers):
154154
# QuerySet would trigger the database: user can run the
155155
# query from SQL Panel
156156
elif isinstance(value, (QuerySet, RawQuerySet)):
157-
temp_layer[key] = "<<{} of {}>>".format(
158-
value.__class__.__name__.lower(),
159-
value.model._meta.label,
160-
)
157+
temp_layer[
158+
key
159+
] = f"<<{value.__class__.__name__.lower()} of {value.model._meta.label}>>"
161160
else:
162161
token = allow_sql.set(False) # noqa: FBT003
163162
try:

pyproject.toml

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -53,44 +53,28 @@ path = "debug_toolbar/__init__.py"
5353

5454
[tool.ruff]
5555
extend-select = [
56-
# pyflakes, pycodestyle
57-
"F", "E", "W",
58-
# mmcabe
59-
# "C90",
60-
# isort
61-
"I",
62-
# pep8-naming
63-
# "N",
64-
# pyupgrade
65-
"UP",
66-
# flake8-2020
67-
# "YTT",
68-
# flake8-boolean-trap
69-
"FBT",
70-
# flake8-bugbear
71-
"B",
72-
# flake8-comprehensions
73-
"C4",
74-
# flake8-django
75-
"DJ",
76-
# flake8-pie
77-
"PIE",
78-
# flake8-simplify
79-
"SIM",
80-
# flake8-gettext
81-
"INT",
82-
# pygrep-hooks
83-
"PGH",
84-
# pylint
85-
# "PL",
86-
# unused noqa
87-
"RUF100",
56+
"ASYNC", # flake8-async
57+
"B", # flake8-bugbear
58+
"C4", # flake8-comprehensions
59+
"C90", # McCabe cyclomatic complexity
60+
"DJ", # flake8-django
61+
"E", # pycodestyle errors
62+
"F", # Pyflakes
63+
"FBT", # flake8-boolean-trap
64+
"I", # isort
65+
"INT", # flake8-gettext
66+
"PGH", # pygrep-hooks
67+
"PIE", # flake8-pie
68+
"RUF100", # Unused noqa directive
69+
"SIM", # flake8-simplify
70+
"SLOT", # flake8-slots
71+
"UP", # pyupgrade
72+
"W", # pycodestyle warnings
8873
]
8974
extend-ignore = [
90-
# Allow zip() without strict=
91-
"B905",
92-
# No line length errors
93-
"E501",
75+
"B905", # Allow zip() without strict=
76+
"E501", # Ignore line length violations
77+
"SIM108", # Use ternary operator instead of if-else-block
9478
]
9579
fix = true
9680
show-fixes = true
@@ -100,14 +84,12 @@ target-version = "py38"
10084
combine-as-imports = true
10185

10286
[tool.ruff.mccabe]
103-
max-complexity = 15
87+
max-complexity = 16
10488

10589
[tool.ruff.per-file-ignores]
10690
"*/migrat*/*" = [
107-
# Allow using PascalCase model names in migrations
108-
"N806",
109-
# Ignore the fact that migration files are invalid module names
110-
"N999",
91+
"N806", # Allow using PascalCase model names in migrations
92+
"N999", # Ignore the fact that migration files are invalid module names
11193
]
11294

11395
[tool.coverage.html]

0 commit comments

Comments
 (0)