Lint the notebooks in the lint session

Only `ruff` checks them because the formatters would rewrite the cells.

The per-file ignores fit exploratory code that is never rerun.
This commit is contained in:
Alexander Hess 2026-12-03 11:45:15 +01:00
commit 7a000145a7
Signed by: alexander
GPG key ID: B46EDB4DFC26805D

View file

@ -97,6 +97,9 @@ PACKAGE_LOCATION = "src/"
DOCS_BUILD = ".cache/docs/"
DOCS_LOCATION = "docs/"
# Only `ruff` lints the notebooks because the formatters would rewrite them
NOTEBOOKS_LOCATION = "research/"
SCRIPTS_LOCATION = "scripts/"
TESTS_LOCATION = "tests/"
@ -266,6 +269,8 @@ def lint_code(session: nox.Session) -> None:
# Interpret extra arguments as `locations` of source files
locations = session.posargs or SRC_LOCATIONS
ruff_locations = session.posargs or (*SRC_LOCATIONS, NOTEBOOKS_LOCATION)
# `flake8` reads the "[tool.flake8]" section in pyproject.toml
# only with the `flake8-pyproject` plugin installed
session.run("flake8", "--version")
@ -275,7 +280,7 @@ def lint_code(session: nox.Session) -> None:
session.run("isort", "--check-only", *locations)
session.run("ruff", "--version")
session.run("ruff", "check", *locations)
session.run("ruff", "check", *ruff_locations)
session.run("mypy", "--version")
session.run("mypy", *TYPECHECK_LOCATIONS)