From 4e1f3b83f7ceb77ee7d83adb499d9dc9b733da54 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 24 Oct 2023 17:00:51 +0200 Subject: [PATCH 1/6] pyproject.toml: Work on readability of ruff settings --- pyproject.toml | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 65a0bee1f..872242aba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,11 +53,7 @@ path = "debug_toolbar/__init__.py" [tool.ruff] extend-select = [ - # pyflakes, pycodestyle "F", "E", "W", - # mmcabe - # "C90", - # isort "I", # pep8-naming # "N", @@ -85,14 +81,30 @@ extend-select = [ # "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 + # "N", # pep8-naming + "PGH", # pygrep-hooks + "PIE", # flake8-pie + "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= ] fix = true +line-length = 124 show-fixes = true target-version = "py38" @@ -100,14 +112,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] From e1f54ac2ead38c70d063cb34d8632e559f2eabd9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 15:01:57 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- debug_toolbar/panels/templates/panel.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/debug_toolbar/panels/templates/panel.py b/debug_toolbar/panels/templates/panel.py index e63417fa9..f8c9242ca 100644 --- a/debug_toolbar/panels/templates/panel.py +++ b/debug_toolbar/panels/templates/panel.py @@ -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: From f0fa244e5f705a5f16abea9896cf313f81355022 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 24 Oct 2023 17:03:31 +0200 Subject: [PATCH 3/6] Update pyproject.toml --- pyproject.toml | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 872242aba..11cbf924c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,33 +53,6 @@ path = "debug_toolbar/__init__.py" [tool.ruff] extend-select = [ - "F", "E", "W", - "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 @@ -95,6 +68,7 @@ extend-select = [ # "N", # pep8-naming "PGH", # pygrep-hooks "PIE", # flake8-pie + "RUF100", # Unused noqa directive "SIM", # flake8-simplify "SLOT", # flake8-slots "UP", # pyupgrade From 98ee8c517dcb49faae1b9852beda9d4d7061ed3f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 24 Oct 2023 17:04:11 +0200 Subject: [PATCH 4/6] Update pyproject.toml --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 11cbf924c..62c47262d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,8 +53,6 @@ path = "debug_toolbar/__init__.py" [tool.ruff] extend-select = [ - "RUF100", - "ASYNC", # flake8-async "B", # flake8-bugbear "C4", # flake8-comprehensions From a944da4a42a235a37cdb4f4b4823e142289cb7b8 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 24 Oct 2023 17:07:38 +0200 Subject: [PATCH 5/6] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 62c47262d..438708001 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -63,7 +63,6 @@ extend-select = [ "FBT", # flake8-boolean-trap "I", # isort "INT", # flake8-gettext - # "N", # pep8-naming "PGH", # pygrep-hooks "PIE", # flake8-pie "RUF100", # Unused noqa directive @@ -74,6 +73,7 @@ extend-select = [ ] extend-ignore = [ "B905", # Allow zip() without strict= + "SIM108", # Use ternary operator instead of if-else-block ] fix = true line-length = 124 From aa1902801b58a794c9ffe9587df1ea0bc3170727 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 24 Oct 2023 17:14:40 +0200 Subject: [PATCH 6/6] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 438708001..5f7abf41e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,10 +73,10 @@ extend-select = [ ] extend-ignore = [ "B905", # Allow zip() without strict= + "E501", # Ignore line length violations "SIM108", # Use ternary operator instead of if-else-block ] fix = true -line-length = 124 show-fixes = true target-version = "py38"