Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

ruff: Enable PERF rules.

Anders Kaseorgca40e60469d0
diff --git a/analytics/lib/fixtures.py b/analytics/lib/fixtures.py
index b7f2bffdf11..12eed78d01e 100644
--- a/analytics/lib/fixtures.py
+++ b/analytics/lib/fixtures.py
@@ -65,7 +65,7 @@ def generate_time_series_data(
seed(random_seed)
noise_scalars = [gauss(0, 1)]
for i in range(1, length):
- noise_scalars.append(
+ noise_scalars.append( # noqa: PERF401 # https://github.com/astral-sh/ruff/issues/6210
noise_scalars[-1] * autocorrelation + gauss(0, 1) * (1 - autocorrelation)
)
diff --git a/pyproject.toml b/pyproject.toml
index 86ac25c3e7d..89318e5b8dc 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -108,6 +108,7 @@ select = [
"INT", # gettext
"ISC", # string concatenation
"N", # naming
+ "PERF", # performance
"PGH", # pygrep-hooks
"PIE", # miscellaneous
"PL", # pylint
@@ -139,6 +140,7 @@ ignore = [
"E731", # Do not assign a lambda expression, use a def
"N802", # Function name should be lowercase
"N806", # Variable in function should be lowercase
+ "PERF203", # `try`-`except` within a loop incurs performance overhead
"PLC1901", # `s == ""` can be simplified to `not s` as an empty string is falsey
"PLR0911", # Too many return statements
"PLR0912", # Too many branches