From b3a185103d7d948a8741c36deffc7cf105797d27 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 12 Apr 2023 16:15:55 -0700 Subject: [PATCH] ruff: Enable new lints INT, PYI. Signed-off-by: Anders Kaseorg --- pyproject.toml | 5 +++++ tools/semgrep.yml | 10 ---------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e853d775e7..f7cc39c389 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,11 +107,13 @@ select = [ "F", # flakes "G", # logging format "I", # import sorting + "INT", # gettext "ISC", # string concatenation "N", # naming "PGH", # pygrep-hooks "PIE", # miscellaneous "PL", # pylint + "PYI", # typing stubs "Q", # quotes "RSE", # raise "RUF", # Ruff @@ -169,5 +171,8 @@ line-length = 100 src = [".", "tools"] target-version = "py38" +[tool.ruff.flake8-gettext] +extend-function-names = ["gettext_lazy"] + [tool.ruff.isort] known-third-party = ["zulip"] diff --git a/tools/semgrep.yml b/tools/semgrep.yml index 53379ba92c..c15bd8c0cf 100644 --- a/tools/semgrep.yml +++ b/tools/semgrep.yml @@ -69,16 +69,6 @@ rules: severity: ERROR message: "Do not write a SQL injection vulnerability please" - - id: translated-format - languages: [python] - pattern-either: - - pattern: django.utils.translation.gettext(... .format(...)) - - pattern: django.utils.translation.gettext(f"...") - - pattern: django.utils.translation.gettext_lazy(... .format(...)) - - pattern: django.utils.translation.gettext_lazy(f"...") - severity: ERROR - message: "Format strings after translation, not before" - - id: translated-format-lazy languages: [python] pattern: django.utils.translation.gettext_lazy(...).format(...)