diff --git a/pyproject.toml b/pyproject.toml index 0e5dcef6753b3..8a86b83babf95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -289,6 +289,7 @@ extend-select = [ "B006", # Checks for uses of mutable objects as function argument defaults. "B017", # Checks for pytest.raises context managers that catch Exception or BaseException. "B019", # Use of functools.lru_cache or functools.cache on methods can lead to memory leaks + "B028", # No explicit stacklevel keyword argument found "TRY002", # Prohibit use of `raise Exception`, use specific exceptions instead. "RUF006", # Checks for asyncio dangling task ] @@ -321,7 +322,7 @@ required-imports = ["from __future__ import annotations"] combine-as-imports = true [tool.ruff.lint.per-file-ignores] -"airflow/__init__.py" = ["F401"] +"airflow/__init__.py" = ["F401", "B028"] "airflow/models/__init__.py" = ["F401", "TCH004"] "airflow/models/sqla_models.py" = ["F401"] @@ -380,6 +381,35 @@ combine-as-imports = true "tests/providers/qdrant/operators/test_qdrant.py" = ["E402"] "tests/providers/snowflake/operators/test_snowflake_sql.py" = ["E402"] +# All the modules which do not follow B028 yet: https://docs.astral.sh/ruff/rules/no-explicit-stacklevel/ +"airflow/api_connexion/endpoints/forward_to_fab_endpoint.py" = ["B028"] +"airflow/cli/commands/connection_command.py" = ["B028"] +"airflow/cli/commands/dag_command.py" = ["B028"] +"airflow/cli/commands/db_command.py" = ["B028"] +"airflow/configuration.py" = ["B028"] +"airflow/decorators/task_group.py" = ["B028"] +"airflow/jobs/scheduler_job_runner.py" = ["B028"] +"airflow/jobs/triggerer_job_runner.py" = ["B028"] +"airflow/kubernetes/pre_7_4_0_compatibility/pod_generator.py" = ["B028"] +"airflow/logging_config.py" = ["B028"] +"airflow/metrics/otel_logger.py" = ["B028"] +"airflow/metrics/validators.py" = ["B028"] +"airflow/models/baseoperator.py" = ["B028"] +"airflow/models/connection.py" = ["B028"] +"airflow/models/mappedoperator.py" = ["B028"] +"airflow/models/param.py" = ["B028"] +"airflow/models/xcom.py" = ["B028"] +"airflow/providers_manager.py" = ["B028"] +"airflow/serialization/serialized_objects.py" = ["B028"] +"airflow/settings.py" = ["B028"] +"airflow/utils/context.py" = ["B028"] +"airflow/utils/dot_renderer.py" = ["B028"] +"airflow/www/app.py" = ["B028"] +"airflow/www/extensions/init_views.py" = ["B028"] +"airflow/providers/jdbc/hooks/jdbc.py" = ["B028"] +"airflow/providers/microsoft/azure/hooks/synapse.py" = ["B028"] +"helm_tests/airflow_aux/test_basic_helm_chart.py" = ["B028"] + [tool.ruff.lint.flake8-tidy-imports] # Disallow all relative imports. ban-relative-imports = "all"