Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
ruff: Enable some new errors.
Anders Kaseorg4898fdb89dd9
diff --git a/pyproject.toml b/pyproject.tomlindex 14be9d27410..39890f0cd90 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -107,7 +107,12 @@ select = ["F", # flakes"I", # import sorting"N", # naming+ "PGH", # pygrep-hooks+ "PLC", # pylint convention+ "PLE", # pylint error+ "PLR", # pylint refactor"RUF", # Ruff+ "T10", # debugger"UP", # upgrade"W", # style warnings"YTT", # sys.version@@ -117,7 +122,7 @@ ignore = ["ANN102", # Missing type annotation for `cls` in classmethod"ANN401", # Dynamically typed expressions (typing.Any) are disallowed"B007", # Loop control variable not used within the loop body- "B008", # Do not perform function calls in argument defaults.+ "B008", # Do not perform function calls in argument defaults"B023", # Function definition does not bind loop variable"B904", # Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling"C408", # Unnecessary `dict` call (rewrite as a literal)diff --git a/tools/semgrep.yml b/tools/semgrep.ymlindex 685d121a8e8..1b54f7131e4 100644--- a/tools/semgrep.yml+++ b/tools/semgrep.yml@@ -101,36 +101,18 @@ rules:- id: mutable-default-typelanguages: [python]pattern-either:- - pattern: |- def $F(..., $A: typing.List[...] = [...], ...) -> ...:- ...- - pattern: |- def $F(..., $A: typing.Optional[typing.List[...]] = [...], ...) -> ...:- ...- pattern: |def $F(..., $A: typing.List[...] = zerver.lib.request.REQ(..., default=[...], ...), ...) -> ...:...- pattern: |def $F(..., $A: typing.Optional[typing.List[...]] = zerver.lib.request.REQ(..., default=[...], ...), ...) -> ...:...- - pattern: |- def $F(..., $A: typing.Dict[...] = {}, ...) -> ...:- ...- - pattern: |- def $F(..., $A: typing.Optional[typing.Dict[...]] = {}, ...) -> ...:- ...- pattern: |def $F(..., $A: typing.Dict[...] = zerver.lib.request.REQ(..., default={}, ...), ...) -> ...:...- pattern: |def $F(..., $A: typing.Optional[typing.Dict[...]] = zerver.lib.request.REQ(..., default={}, ...), ...) -> ...:...- - pattern: |- def $F(..., $A: typing.Set[...] = set(), ...) -> ...:- ...- - pattern: |- def $F(..., $A: typing.Optional[typing.Set[...]] = set(), ...) -> ...:- ...severity: ERRORmessage: "Guard mutable default with read-only type (Sequence, Mapping, AbstractSet)"@@ -143,12 +125,6 @@ rules:severity: ERRORmessage: "Prefer f-strings or .format for string formatting"- - id: eval- languages: [python]- pattern: eval- severity: ERROR- message: "Do not use eval under any circumstances; consider json.loads instead"-- id: typing-textlanguages: [python]pattern: typing.Text