From ca40e60469d0ac7d7eac3fdeecbd4023d0b27dd2 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 31 Jul 2023 15:23:52 -0700 Subject: [PATCH] ruff: Enable PERF rules. Signed-off-by: Anders Kaseorg --- analytics/lib/fixtures.py | 2 +- pyproject.toml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/analytics/lib/fixtures.py b/analytics/lib/fixtures.py index b7f2bffdf1..12eed78d01 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 86ac25c3e7..89318e5b8d 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