Skip to content

Comments

[airflow] Extend AIR302 with additional symbols#17085

Merged
dhruvmanila merged 8 commits intoastral-sh:mainfrom
astronomer:add-new-AIR302-rules
Apr 2, 2025
Merged

[airflow] Extend AIR302 with additional symbols#17085
dhruvmanila merged 8 commits intoastral-sh:mainfrom
astronomer:add-new-AIR302-rules

Conversation

@Lee-W
Copy link
Contributor

@Lee-W Lee-W commented Mar 31, 2025

Summary

  • airflow.auth.managers.base_auth_manager.is_authorized_dataset has been moved to airflow.api_fastapi.auth.managers.base_auth_manager.is_authorized_asset in Airflow 3.0
  • airflow.auth.managers.models.resource_details.DatasetDetails has been moved to airflow.api_fastapi.auth.managers.models.resource_details.AssetDetails in Airflow 3.0
  • Dag arguments default_view and orientation has been removed in Airflow 3.0
  • airflow.models.baseoperatorlink.BaseOperatorLink has been moved to airflow.sdk.definitions.baseoperatorlink.BaseOperatorLink in Airflow 3.0
  • airflow.notifications.basenotifier.BaseNotifier has been moved to airflow.sdk.BaseNotifier in Airflow 3.0
  • airflow.utils.log.secrets_masker has been moved to airflow.sdk.execution_time.secrets_masker in Airflow 3.0
  • airflow...DAG.allow_future_exec_dates has been removed in Airflow 3.0
  • airflow.utils.db.create_session has een removed in Airflow 3.0
  • airflow.sensors.base_sensor_operator.BaseSensorOperator has been moved to airflow.sdk.bases.sensor.BaseSensorOperator removed Airflow 3.0
  • airflow.utils.file.TemporaryDirectory has been removed in Airflow 3.0 and can be replaced by tempfile.TemporaryDirectory
  • airflow.utils.file.mkdirs has been removed in Airflow 3.0 and can be replaced by pathlib.Path({path}).mkdir

Test Plan

Test fixture has been added for these changes

@github-actions
Copy link
Contributor

github-actions bot commented Mar 31, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+21 -0 violations, +0 -0 fixes in 1 projects; 54 projects unchanged)

apache/airflow (+21 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL

+ dev/airflow_perf/scheduler_dag_execution_timing.py:256:13: AIR302 `airflow.utils.db.create_session` is removed in Airflow 3.0
+ dev/airflow_perf/scheduler_dag_execution_timing.py:303:21: AIR302 `airflow.utils.db.create_session` is removed in Airflow 3.0
+ providers/amazon/src/airflow/providers/amazon/aws/links/base_aws.py:41:19: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/databricks/src/airflow/providers/databricks/operators/databricks.py:242:28: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/databricks/src/airflow/providers/databricks/plugins/databricks_workflow.py:234:26: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/databricks/src/airflow/providers/databricks/plugins/databricks_workflow.py:268:38: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/databricks/src/airflow/providers/databricks/plugins/databricks_workflow.py:362:39: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/dbt/cloud/src/airflow/providers/dbt/cloud/operators/dbt.py:50:34: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/google/src/airflow/providers/google/cloud/links/base.py:38:22: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/google/src/airflow/providers/google/cloud/links/datafusion.py:44:22: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/google/src/airflow/providers/google/cloud/links/dataproc.py:136:24: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/google/src/airflow/providers/google/cloud/links/dataproc.py:83:20: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/google/src/airflow/providers/google/cloud/operators/dataproc_metastore.py:112:37: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/google/src/airflow/providers/google/cloud/operators/dataproc_metastore.py:64:29: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/google/src/airflow/providers/google/marketing_platform/links/analytics_admin.py:39:31: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/data_factory.py:52:53: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/powerbi.py:42:19: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/synapse.py:133:35: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py:71:25: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/standard/src/airflow/providers/standard/sensors/external_task.py:58:23: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0
+ providers/yandex/src/airflow/providers/yandex/links/yq.py:43:14: AIR302 `airflow.models.baseoperatorlink.BaseOperatorLink` is removed in Airflow 3.0

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
AIR302 21 21 0 0 0

@Lee-W Lee-W changed the title feat(AIR302): add rule "airflow.models.baseoperatorlink.BaseOperatorL… [airflow] extend AIR302 rules Mar 31, 2025
@Lee-W Lee-W force-pushed the add-new-AIR302-rules branch 2 times, most recently from fc5eda9 to f1dbda8 Compare March 31, 2025 15:00
@Lee-W Lee-W marked this pull request as ready for review March 31, 2025 15:05
@Lee-W Lee-W mentioned this pull request Mar 31, 2025
2 tasks
@dhruvmanila dhruvmanila added rule Implementing or modifying a lint rule preview Related to preview mode features labels Mar 31, 2025
@Lee-W Lee-W requested a review from dhruvmanila April 1, 2025 02:00
@Lee-W Lee-W force-pushed the add-new-AIR302-rules branch 2 times, most recently from 1cbdd9e to e2a13d0 Compare April 1, 2025 09:59
@Lee-W Lee-W force-pushed the add-new-AIR302-rules branch from e2a13d0 to ba89eeb Compare April 2, 2025 10:00
Lee-W added 8 commits April 2, 2025 19:08
…ink → airflow.sdk.definitions.baseoperatorlink.BaseOperatorLink"
* ``airflow.auth.managers.base_auth_manager.is_authorized_dataset`` → ``airflow.api_fastapi.auth.managers.base_auth_manager.is_authorized_asset``
* ``airflow.auth.managers.models.resource_details.DatasetDetails`` → ``airflow.api_fastapi.auth.managers.models.resource_details.AssetDetails``
* Dag arguments default_view and orientation removed
* ``airflow.notifications.basenotifier.BaseNotifier`` → ``airflow.sdk.BaseNotifier``
* ``airflow.utils.log.secrets_masker`` → ``airflow.sdk.execution_time.secrets_masker``
…nsorOperator → airflow.sdk.bases.sensor.BaseSensorOperator"
@Lee-W Lee-W force-pushed the add-new-AIR302-rules branch from ba89eeb to ce6d69c Compare April 2, 2025 11:12
@dhruvmanila dhruvmanila changed the title [airflow] extend AIR302 rules [airflow] Extend AIR302 with additional symbols Apr 2, 2025
@dhruvmanila dhruvmanila merged commit fc2a095 into astral-sh:main Apr 2, 2025
22 checks passed
dcreager added a commit that referenced this pull request Apr 3, 2025
* origin/main: (35 commits)
  [red-knot] Callable types are disjoint from literals (#17160)
  [red-knot] Fix inference for `pow` between two literal integers (#17161)
  [red-knot] Add GitHub PR annotations when mdtests fail in CI (#17150)
  [red-knot] Fix equivalence of differently ordered unions that contain `Callable` types (#17145)
  [red-knot] Add initial set of tests for unreachable code (#17159)
  [`airflow`] Move `AIR302` to `AIR301` and `AIR303` to `AIR302` (#17151)
  ruff_db: simplify lifetimes on `DiagnosticDisplay`
  [red-knot] Detect division-by-zero in unions and intersections (#17157)
  [`airflow`] Add autofix infrastructure to `AIR302` name checks (#16965)
  [`flake8-bandit`] Mark `str` and `list[str]` literals as trusted input (`S603`) (#17136)
  [`airflow`] Add autofix for `AIR302` attribute checks (#16977)
  [`airflow`] Extend `AIR302` with additional symbols (#17085)
  [`airflow`] Move `AIR301` to `AIR002` (#16978)
  [`airflow`] Add autofix for `AIR302` method checks (#16976)
  ruff_db: switch diagnostic rendering over to `std::fmt::Display`
  [red-knot] Add 'Goto type definition' to the playground (#17055)
  red_knot_ide: update snapshots
  red_knot_python_semantic: remove comment about `TypeCheckDiagnostic`
  ruff_db: delete most of the old diagnostic code
  red_knot: use `Diagnostic` inside of red knot
  ...
dcreager added a commit that referenced this pull request Apr 3, 2025
* origin/main: (82 commits)
  [red-knot] Fix more [redundant-cast] false positives (#17170)
  [red-knot] Three-argument type-calls take 'str' as the first argument (#17168)
  Control flow: `return` and `raise` (#17121)
  Bump 0.11.3 (#17173)
  [red-knot] Improve `Debug` implementation for `semantic_index::SymbolTable` (#17172)
  [red-knot] Fix `str(…)` calls (#17163)
  [red-knot] visibility_constraint analysis for match cases (#17077)
  [red-knot] Fix playground crashes when diagnostics are stale (#17165)
  [red-knot] Callable types are disjoint from literals (#17160)
  [red-knot] Fix inference for `pow` between two literal integers (#17161)
  [red-knot] Add GitHub PR annotations when mdtests fail in CI (#17150)
  [red-knot] Fix equivalence of differently ordered unions that contain `Callable` types (#17145)
  [red-knot] Add initial set of tests for unreachable code (#17159)
  [`airflow`] Move `AIR302` to `AIR301` and `AIR303` to `AIR302` (#17151)
  ruff_db: simplify lifetimes on `DiagnosticDisplay`
  [red-knot] Detect division-by-zero in unions and intersections (#17157)
  [`airflow`] Add autofix infrastructure to `AIR302` name checks (#16965)
  [`flake8-bandit`] Mark `str` and `list[str]` literals as trusted input (`S603`) (#17136)
  [`airflow`] Add autofix for `AIR302` attribute checks (#16977)
  [`airflow`] Extend `AIR302` with additional symbols (#17085)
  ...
maxmynter pushed a commit to maxmynter/ruff that referenced this pull request Apr 3, 2025
## Summary

* ``airflow.auth.managers.base_auth_manager.is_authorized_dataset`` has
been moved to
``airflow.api_fastapi.auth.managers.base_auth_manager.is_authorized_asset``
in Airflow 3.0
* ``airflow.auth.managers.models.resource_details.DatasetDetails`` has
been moved to
``airflow.api_fastapi.auth.managers.models.resource_details.AssetDetails``
in Airflow 3.0
* Dag arguments `default_view` and `orientation` has been removed in
Airflow 3.0
* `airflow.models.baseoperatorlink.BaseOperatorLink` has been moved to
`airflow.sdk.definitions.baseoperatorlink.BaseOperatorLink` in Airflow
3.0
* ``airflow.notifications.basenotifier.BaseNotifier`` has been moved to
``airflow.sdk.BaseNotifier`` in Airflow 3.0
* ``airflow.utils.log.secrets_masker`` has been moved to
``airflow.sdk.execution_time.secrets_masker`` in Airflow 3.0
* ``airflow...DAG.allow_future_exec_dates`` has been removed in Airflow
3.0
* `airflow.utils.db.create_session` has een removed in Airflow 3.0
* `airflow.sensors.base_sensor_operator.BaseSensorOperator` has been
moved to `airflow.sdk.bases.sensor.BaseSensorOperator` removed Airflow
3.0
* `airflow.utils.file.TemporaryDirectory` has been removed in Airflow
3.0 and can be replaced by `tempfile.TemporaryDirectory`
* `airflow.utils.file.mkdirs` has been removed in Airflow 3.0 and can be
replaced by `pathlib.Path({path}).mkdir`

## Test Plan

Test fixture has been added for these changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview Related to preview mode features rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants