Enable PLR in ruff
All checks were successful
CI / Checks (Python 3.13) (push) Successful in 1m43s

This commit is contained in:
Alexander Hess 2026-11-28 04:57:25 +01:00
commit a24db98262
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
6 changed files with 11 additions and 6 deletions

View file

@ -482,6 +482,8 @@ select = [
"ERA", "ERA",
# isort => imports are sorted # isort => imports are sorted
"I", "I",
# Pylint's refactoring rules => simpler and smaller functions
"PLR",
# flake8-print => no `print()` # flake8-print => no `print()`
"T20", "T20",
] ]
@ -489,6 +491,8 @@ select = [
extend-ignore = [ extend-ignore = [
# Let the formatter handle trailing commas. # Let the formatter handle trailing commas.
"COM812", "COM812",
# Thresholds like the ones in the maps read better as literals.
"PLR2004",
# Let's not do `@pytest.mark.no_cover()` instead of `@pytest.mark.no_cover`. # Let's not do `@pytest.mark.no_cover()` instead of `@pytest.mark.no_cover`.
"PT023", "PT023",
# TODOs need neither an author nor an issue. # TODOs need neither an author nor an issue.
@ -511,9 +515,10 @@ extend-ignore = [
"scripts/**" = ["T20"] "scripts/**" = ["T20"]
# - ANN0, ANN2 => Type annotations are not strictly enforced. # - ANN0, ANN2 => Type annotations are not strictly enforced.
# - D106 => The `Meta` class inside the factory_boy models do not need a docstring. # - D106 => The `Meta` class inside the factory_boy models do not need a docstring.
# - PLR0913, PLR0917 => `pytest` passes fixtures as arguments.
# - S101 => `assert` statements are ok in the test suite. # - S101 => `assert` statements are ok in the test suite.
# - S311 => The `random` module is not used for cryptography. # - S311 => The `random` module is not used for cryptography.
"tests/**/*.py" = ["ANN0", "ANN2", "D106", "S101", "S311"] "tests/**/*.py" = ["ANN0", "ANN2", "D106", "PLR0913", "PLR0917", "S101", "S311"]
[tool.ruff.lint.flake8-pytest-style] # aligned with [tool.flake8] above [tool.ruff.lint.flake8-pytest-style] # aligned with [tool.flake8] above

View file

@ -254,7 +254,7 @@ class Path(meta.Base):
return points return points
def draw( def draw( # noqa:PLR0913
self, self,
*, *,
reverse: bool = False, reverse: bool = False,

View file

@ -40,7 +40,7 @@ class Customer(meta.Base):
"""Shortcut to the `...city.map` object.""" """Shortcut to the `...city.map` object."""
return self.orders[0].pickup_address.city.map return self.orders[0].pickup_address.city.map
def draw( # noqa:C901 def draw( # noqa:C901,PLR0912
self, self,
restaurants: bool = True, restaurants: bool = True,
order_counts: bool = False, # pragma: no cover order_counts: bool = False, # pragma: no cover

View file

@ -141,7 +141,7 @@ class Pixel(meta.Base):
"""Shortcut to the `.city.map` object.""" """Shortcut to the `.city.map` object."""
return self.grid.city.map return self.grid.city.map
def draw( # noqa:C901 def draw( # noqa:C901,PLR0912
self, self,
restaurants: bool = True, restaurants: bool = True,
order_counts: bool = False, # pragma: no cover order_counts: bool = False, # pragma: no cover

View file

@ -12,7 +12,7 @@ from rpy2 import robjects
from rpy2.robjects import pandas2ri from rpy2.robjects import pandas2ri
def stl( # noqa:C901 def stl( # noqa:C901,PLR0912,PLR0913,PLR0915
time_series: pd.Series, time_series: pd.Series,
*, *,
frequency: int, frequency: int,

View file

@ -98,7 +98,7 @@ class TestSpecialMethods:
def test_compare_utm_coordinates_to_themselves(self, location): def test_compare_utm_coordinates_to_themselves(self, location):
"""Test `Location.__eq__()`.""" """Test `Location.__eq__()`."""
result = location == location result = location == location # noqa:PLR0124
assert result is True assert result is True