mirror of https://github.com/zulip/zulip.git
ruff: Enable new lints INT, PYI.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
bb2c0ad3bf
commit
b3a185103d
|
@ -107,11 +107,13 @@ select = [
|
||||||
"F", # flakes
|
"F", # flakes
|
||||||
"G", # logging format
|
"G", # logging format
|
||||||
"I", # import sorting
|
"I", # import sorting
|
||||||
|
"INT", # gettext
|
||||||
"ISC", # string concatenation
|
"ISC", # string concatenation
|
||||||
"N", # naming
|
"N", # naming
|
||||||
"PGH", # pygrep-hooks
|
"PGH", # pygrep-hooks
|
||||||
"PIE", # miscellaneous
|
"PIE", # miscellaneous
|
||||||
"PL", # pylint
|
"PL", # pylint
|
||||||
|
"PYI", # typing stubs
|
||||||
"Q", # quotes
|
"Q", # quotes
|
||||||
"RSE", # raise
|
"RSE", # raise
|
||||||
"RUF", # Ruff
|
"RUF", # Ruff
|
||||||
|
@ -169,5 +171,8 @@ line-length = 100
|
||||||
src = [".", "tools"]
|
src = [".", "tools"]
|
||||||
target-version = "py38"
|
target-version = "py38"
|
||||||
|
|
||||||
|
[tool.ruff.flake8-gettext]
|
||||||
|
extend-function-names = ["gettext_lazy"]
|
||||||
|
|
||||||
[tool.ruff.isort]
|
[tool.ruff.isort]
|
||||||
known-third-party = ["zulip"]
|
known-third-party = ["zulip"]
|
||||||
|
|
|
@ -69,16 +69,6 @@ rules:
|
||||||
severity: ERROR
|
severity: ERROR
|
||||||
message: "Do not write a SQL injection vulnerability please"
|
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
|
- id: translated-format-lazy
|
||||||
languages: [python]
|
languages: [python]
|
||||||
pattern: django.utils.translation.gettext_lazy(...).format(...)
|
pattern: django.utils.translation.gettext_lazy(...).format(...)
|
||||||
|
|
Loading…
Reference in New Issue