From 195fa081987306ba4aaae42d5d21f88278739ee5 Mon Sep 17 00:00:00 2001 From: Sam Oehlert Date: Fri, 4 Apr 2025 12:03:34 -0500 Subject: [PATCH 1/2] refactor(ruff): ignore ruff on this one ruff seems to think this is a list and doesn't like how we're string indexing --- config/settings/local.py | 1 + 1 file changed, 1 insertion(+) diff --git a/config/settings/local.py b/config/settings/local.py index 50ac7413..d3ac272e 100644 --- a/config/settings/local.py +++ b/config/settings/local.py @@ -55,6 +55,7 @@ import socket hostname, _, ips = socket.gethostbyname_ex(socket.gethostname()) + # ruff: noqa: RUF005 INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips] # django-extensions From 5ac8e26b3f4beecb818aba614a126b86dabf25cc Mon Sep 17 00:00:00 2001 From: Sam Oehlert Date: Fri, 4 Apr 2025 13:36:23 -0500 Subject: [PATCH 2/2] refactor(ruff): ignore comprehensions in ruff because we don't like them also add a comment so we know what the INTERNAL_IPS stuff is about --- config/settings/local.py | 1 + pyproject.toml | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/config/settings/local.py b/config/settings/local.py index d3ac272e..899ee6e8 100644 --- a/config/settings/local.py +++ b/config/settings/local.py @@ -55,6 +55,7 @@ import socket hostname, _, ips = socket.gethostbyname_ex(socket.gethostname()) + # This comes from the cookiecutter and while we don't like it, it's not worth the effort to fix yet # ruff: noqa: RUF005 INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips] diff --git a/pyproject.toml b/pyproject.toml index 9a3043ac..703a5663 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -81,8 +81,10 @@ ignore = [ "DOC501", # add possible exceptions to the docstring (TODO) "ISC001", # handled by the formatter "RUF012", # need more widespread typing - "SIM102", # Use a single `if` statement instead of nested `if` statements - "SIM108", # Use ternary operator instead of `if`-`else`-block + "SIM102", # use a single `if` statement instead of nested `if` statements + "SIM108", # use ternary operator instead of `if`-`else`-block + "PERF401", # list comprehensions are harder to read in our opinion and not worth the performance gain + "PERF403", # dict comprehensions are harder to read in our opinion and not worth the performance gain ] [tool.ruff.lint.mccabe]