Skip to content

Commit

Permalink
pyproject.toml: Work on the readability of ruff settings (#1850)
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed Oct 27, 2023
1 parent 3bcae73 commit e1658db
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 45 deletions.
7 changes: 3 additions & 4 deletions debug_toolbar/panels/templates/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,9 @@ def process_context_list(self, context_layers):
# QuerySet would trigger the database: user can run the
# query from SQL Panel
elif isinstance(value, (QuerySet, RawQuerySet)):
temp_layer[key] = "<<{} of {}>>".format(
value.__class__.__name__.lower(),
value.model._meta.label,
)
temp_layer[
key
] = f"<<{value.__class__.__name__.lower()} of {value.model._meta.label}>>"
else:
token = allow_sql.set(False) # noqa: FBT003
try:
Expand Down
64 changes: 23 additions & 41 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,44 +53,28 @@ path = "debug_toolbar/__init__.py"

[tool.ruff]
extend-select = [
# pyflakes, pycodestyle
"F", "E", "W",
# mmcabe
# "C90",
# isort
"I",
# pep8-naming
# "N",
# pyupgrade
"UP",
# flake8-2020
# "YTT",
# flake8-boolean-trap
"FBT",
# flake8-bugbear
"B",
# flake8-comprehensions
"C4",
# flake8-django
"DJ",
# flake8-pie
"PIE",
# flake8-simplify
"SIM",
# flake8-gettext
"INT",
# pygrep-hooks
"PGH",
# pylint
# "PL",
# unused noqa
"RUF100",
"ASYNC", # flake8-async
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"C90", # McCabe cyclomatic complexity
"DJ", # flake8-django
"E", # pycodestyle errors
"F", # Pyflakes
"FBT", # flake8-boolean-trap
"I", # isort
"INT", # flake8-gettext
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"RUF100", # Unused noqa directive
"SIM", # flake8-simplify
"SLOT", # flake8-slots
"UP", # pyupgrade
"W", # pycodestyle warnings
]
extend-ignore = [
# Allow zip() without strict=
"B905",
# No line length errors
"E501",
"B905", # Allow zip() without strict=
"E501", # Ignore line length violations
"SIM108", # Use ternary operator instead of if-else-block
]
fix = true
show-fixes = true
Expand All @@ -100,14 +84,12 @@ target-version = "py38"
combine-as-imports = true

[tool.ruff.mccabe]
max-complexity = 15
max-complexity = 16

[tool.ruff.per-file-ignores]
"*/migrat*/*" = [
# Allow using PascalCase model names in migrations
"N806",
# Ignore the fact that migration files are invalid module names
"N999",
"N806", # Allow using PascalCase model names in migrations
"N999", # Ignore the fact that migration files are invalid module names
]

[tool.coverage.html]
Expand Down

0 comments on commit e1658db

Please sign in to comment.