diff --git a/noxfile.py b/noxfile.py index 03ee1a9..0b0b9c2 100644 --- a/noxfile.py +++ b/noxfile.py @@ -185,6 +185,7 @@ def lint_code(session: Session) -> None: 'flake8-bandit', 'flake8-black', 'flake8-broken-line', + 'flake8-bugbear', 'flake8-pyproject', 'flake8-pytest-style', 'isort', diff --git a/pyproject.toml b/pyproject.toml index dfede5f..8f48b17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,6 +94,7 @@ dev = [ "flake8-bandit (>=4.1.1,<5.0.0)", "flake8-black (>=0.5.0,<0.6.0)", "flake8-broken-line (>=1.0.0,<2.0.0)", + "flake8-bugbear (>=26.11.22,<27.0.0)", "flake8-pyproject (>=1.2.4,<2.0.0)", "flake8-pytest-style (>=2.2.0,<3.0.0)", "mypy (>=2.4.1,<3.0.0)", diff --git a/src/velofy/configuration.py b/src/velofy/configuration.py index 2e4247e..6d2d5dc 100644 --- a/src/velofy/configuration.py +++ b/src/velofy/configuration.py @@ -124,13 +124,19 @@ def make_config(env: str = 'production') -> Config: # the warning is only emitted if the code is not run by pytest. # We see the bad configuration immediately as all "db" tests fail. if config.DATABASE_URI is None and not os.getenv('TESTING'): - warnings.warn('Bad configuration: no DATABASE_URI set in the environment') + warnings.warn( + 'Bad configuration: no DATABASE_URI set in the environment', + stacklevel=2, + ) # Some functionalities require R and some packages installed. # To ensure isolation and reproducibility, the projects keeps the R dependencies # in a project-local folder that must be set in the environment. if config.R_LIBS_PATH is None and not os.getenv('TESTING'): - warnings.warn('Bad configuration: no R_LIBS set in the environment') + warnings.warn( + 'Bad configuration: no R_LIBS set in the environment', + stacklevel=2, + ) return config diff --git a/src/velofy/console/forecasts.py b/src/velofy/console/forecasts.py index a52470e..0940f58 100644 --- a/src/velofy/console/forecasts.py +++ b/src/velofy/console/forecasts.py @@ -90,7 +90,7 @@ def tactical_heuristic( # noqa:C901 click.echo( 'Parameters: ' - + f'city="{city}", grid.side_length={side_length}, ' + + f'city={city}, grid.side_length={side_length}, ' + f'time_step={time_step}, train_horizon={train_horizon}', ) diff --git a/src/velofy/forecasts/methods/ets.py b/src/velofy/forecasts/methods/ets.py index 0b21e83..d8fd71d 100644 --- a/src/velofy/forecasts/methods/ets.py +++ b/src/velofy/forecasts/methods/ets.py @@ -56,7 +56,7 @@ def predict( f""" as.data.frame( forecast( - ets(data, model = "{model:s}"), + ets(data, model = "{model:s}"), # noqa:B907 h = {n_steps_ahead:d} ) ) diff --git a/uv.lock b/uv.lock index 2183bdf..6751708 100644 --- a/uv.lock +++ b/uv.lock @@ -925,6 +925,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/31/ff/57d0101933527b5202cc9f80bc15aa85b207916c722a00e7adde0e33f413/flake8_broken_line-1.0.0-py3-none-any.whl", hash = "sha256:96c964336024a5030dc536a9f6fb02aa679e2d2a6b35b80a558b5136c35832a9", size = 4202, upload-time = "2023-05-31T10:09:10.027Z" }, ] +[[package]] +name = "flake8-bugbear" +version = "26.11.22" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "attrs" }, + { name = "flake8" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/26/b4/2d6c97486396d8ab985537ce01de9048cff21b6c3f9d0029d261e1017132/flake8_bugbear-26.11.22.tar.gz", hash = "sha256:df1a764570a3047deb99c6c1309679277815ef48d7c9dada7e04973e2b327a10", size = 148709, upload-time = "2026-11-22T14:25:52.305Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/46/ba/da7d4108baed185aecfc0c8cc8e64b2964f92a1897d3310b79c168ac94d3/flake8_bugbear-26.11.22-py3-none-any.whl", hash = "sha256:bc10d62be1dc512dc7825ee34c20492425370b209e47fb09a1dedd29eba49aca", size = 65763, upload-time = "2026-11-22T14:25:51.217Z" }, +] + [[package]] name = "flake8-plugin-utils" version = "1.3.3" @@ -3578,6 +3591,7 @@ dev = [ { name = "flake8-bandit" }, { name = "flake8-black" }, { name = "flake8-broken-line" }, + { name = "flake8-bugbear" }, { name = "flake8-pyproject" }, { name = "flake8-pytest-style" }, { name = "isort" }, @@ -3631,6 +3645,7 @@ dev = [ { name = "flake8-bandit", specifier = ">=4.1.1,<5.0.0" }, { name = "flake8-black", specifier = ">=0.5.0,<0.6.0" }, { name = "flake8-broken-line", specifier = ">=1.0.0,<2.0.0" }, + { name = "flake8-bugbear", specifier = ">=26.11.22,<27.0.0" }, { name = "flake8-pyproject", specifier = ">=1.2.4,<2.0.0" }, { name = "flake8-pytest-style", specifier = ">=2.2.0,<3.0.0" }, { name = "isort", specifier = ">=9.0.2,<10.0.0" },