Add ruff to the "lint" session

`ruff` runs alongside `flake8` and `isort`,
with the rules aligned to theirs:
- `noqa` comments go where both tools expect them
- `import`s stay sorted case-insensitively,
  now stated explicitly in both tools
- `print()` in the "docs" session became `session.log()`
This commit is contained in:
Alexander Hess 2026-11-28 04:37:02 +01:00
commit 318dff8fc8
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
6 changed files with 166 additions and 12 deletions

View file

@ -20,7 +20,7 @@ def db_revision(
"""Do not execute the `func` if the revision does not match."""
if not os.getenv("TESTING"):
result = subprocess.run( # noqa:S603,S607
["alembic", "current"],
["alembic", "current"], # noqa:S607
capture_output=True,
check=False,
encoding="utf8",

View file

@ -24,7 +24,7 @@ from velofy.forecasts import timify
@click.argument("time_step", default=60, type=int)
@click.argument("train_horizon", default=8, type=int)
@decorators.db_revision("8bfb928a31f8")
def tactical_heuristic( # noqa:C901,DOC001
def tactical_heuristic( # noqa:C901,D417,DOC001
city: str,
side_length: int,
time_step: int,

View file

@ -33,7 +33,7 @@ class Path(meta.Base):
Implements an association pattern between `Address` and `Address`.
Further info:
https://docs.sqlalchemy.org/en/stable/orm/basic_relationships.html#association-object # noqa:E501
https://docs.sqlalchemy.org/en/stable/orm/basic_relationships.html#association-object
"""
__tablename__ = "addresses_addresses"

View file

@ -13,7 +13,7 @@ class AddressPixelAssociation(meta.Base):
updates the `city_id` and `grid_id` columns.
Further info:
https://docs.sqlalchemy.org/en/stable/orm/basic_relationships.html#association-object # noqa:E501
https://docs.sqlalchemy.org/en/stable/orm/basic_relationships.html#association-object
"""
__tablename__ = "addresses_pixels"

View file

@ -216,14 +216,14 @@ class City(meta.Base):
row[0]
for row in db.session.execute(
sa.text(
f""" -- # noqa:S608
f"""
SELECT DISTINCT
{config.CLEAN_SCHEMA}.addresses.zip_code
FROM
{config.CLEAN_SCHEMA}.addresses AS addresses
WHERE
{config.CLEAN_SCHEMA}.addresses.city_id = {self.id};
""",
""", # noqa:S608
),
)
)

View file

@ -71,7 +71,7 @@ class OrderHistory:
# This happens when there is no demand in the `Pixel` in the given `time_step`.
data = pd.read_sql_query(
sa.text(
f""" -- # noqa:S608
f"""
SELECT
pixel_id,
start_at,
@ -139,7 +139,7 @@ class OrderHistory:
ORDER BY
pixel_id,
start_at;
""",
""", # noqa:S608
),
con=db.connection,
index_col=["pixel_id", "start_at"],