ruff: Enable PERF rules.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2023-07-31 15:23:52 -07:00 committed by Tim Abbott
parent 562a79ab76
commit ca40e60469
2 changed files with 3 additions and 1 deletions

View File

@ -65,7 +65,7 @@ def generate_time_series_data(
seed(random_seed) seed(random_seed)
noise_scalars = [gauss(0, 1)] noise_scalars = [gauss(0, 1)]
for i in range(1, length): 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) noise_scalars[-1] * autocorrelation + gauss(0, 1) * (1 - autocorrelation)
) )

View File

@ -108,6 +108,7 @@ select = [
"INT", # gettext "INT", # gettext
"ISC", # string concatenation "ISC", # string concatenation
"N", # naming "N", # naming
"PERF", # performance
"PGH", # pygrep-hooks "PGH", # pygrep-hooks
"PIE", # miscellaneous "PIE", # miscellaneous
"PL", # pylint "PL", # pylint
@ -139,6 +140,7 @@ ignore = [
"E731", # Do not assign a lambda expression, use a def "E731", # Do not assign a lambda expression, use a def
"N802", # Function name should be lowercase "N802", # Function name should be lowercase
"N806", # Variable in function 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 "PLC1901", # `s == ""` can be simplified to `not s` as an empty string is falsey
"PLR0911", # Too many return statements "PLR0911", # Too many return statements
"PLR0912", # Too many branches "PLR0912", # Too many branches