Add ruff to the project #6

Merged
alexander merged 5 commits from add-ruff into develop 2026-11-28 05:01:26 +01:00
6 changed files with 11 additions and 6 deletions
Showing only changes of commit a24db98262 - Show all commits

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

Alexander Hess 2026-11-28 04:57:25 +01:00
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -482,6 +482,8 @@ select = [
"ERA",
# isort => imports are sorted
"I",
# Pylint's refactoring rules => simpler and smaller functions
"PLR",
# flake8-print => no `print()`
"T20",
]
@ -489,6 +491,8 @@ select = [
extend-ignore = [
# Let the formatter handle trailing commas.
"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`.
"PT023",
# TODOs need neither an author nor an issue.
@ -511,9 +515,10 @@ extend-ignore = [
"scripts/**" = ["T20"]
# - ANN0, ANN2 => Type annotations are not strictly enforced.
# - 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.
# - 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

View file

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

View file

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

View file

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

View file

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

View file

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