Skip to content

[airflow] Extend AIR311 rules #17422

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 16, 2025
Merged

Conversation

Lee-W
Copy link
Contributor

@Lee-W Lee-W commented Apr 16, 2025

Summary

  • Extend the following AIR311 rules
    • airflow.io.path.ObjectStoragePathairflow.sdk.ObjectStoragePath
    • airflow.io.storage.attachairflow.sdk.io.attach
    • airflow.models.dag.DAGairflow.sdk.DAG
    • airflow.models.DAGairflow.sdk.DAG
    • airflow.decorators.dagairflow.sdk.dag
    • airflow.decorators.taskairflow.sdk.task
    • airflow.decorators.task_groupairflow.sdk.task_group
    • airflow.decorators.setupairflow.sdk.setup
    • airflow.decorators.teardownairflow.sdk.teardown

Test Plan

The test case has been added to the button of the existing test fixtures, confirmed to be correct and later reorgnaized

Copy link
Contributor

github-actions bot commented Apr 16, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

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

apache/airflow (+1827 -134 violations, +0 -0 fixes)

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

+ airflow-core/src/airflow/api/common/mark_tasks.py:106:10: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api/common/mark_tasks.py:142:22: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api/common/mark_tasks.py:195:10: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api/common/mark_tasks.py:239:10: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api/common/mark_tasks.py:325:10: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api/common/mark_tasks.py:356:10: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api/common/mark_tasks.py:87:32: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/datamodels/dag_run.py:108:37: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/assets.py:320:10: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:159:10: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:263:10: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:337:14: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:401:14: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_versions.py:109:14: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/dags.py:170:10: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/dags.py:197:10: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/extra_links.py:58:10: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py:729:12: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/tasks.py:52:10: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/tasks.py:77:10: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/api_fastapi/core_api/routes/public/xcom.py:188:10: AIR311 `airflow.models.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/cli/commands/dag_command.py:287:34: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/cli/commands/dag_command.py:426:29: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/cli/commands/dag_command.py:434:42: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/cli/commands/dag_command.py:434:88: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
+ airflow-core/src/airflow/cli/commands/dag_command.py:545:30: AIR311 `airflow.models.dag.DAG` is removed in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
... 1802 additional changes omitted for rule AIR311
- providers/amazon/tests/system/amazon/aws/example_appflow.py:102:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_appflow_run.py:182:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_athena.py:159:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_azure_blob_to_s3.py:65:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_batch.py:258:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_bedrock.py:108:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_bedrock.py:137:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_bedrock.py:197:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_bedrock_batch_inference.py:167:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_bedrock_retrieve_and_generate.py:111:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_bedrock_retrieve_and_generate.py:112:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_bedrock_retrieve_and_generate.py:567:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_cloudformation.py:101:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_comprehend.py:118:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_comprehend.py:74:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_comprehend_document_classifier.py:109:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_comprehend_document_classifier.py:198:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_datasync.py:217:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_dms.py:408:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_dms_serverless.py:345:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_dynamodb.py:109:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_dynamodb_to_s3.py:154:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_dynamodb_to_s3.py:234:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
- providers/amazon/tests/system/amazon/aws/example_ec2.py:187:5: AIR301 `airflow.models.baseoperator.chain` is removed in Airflow 3.0
... 1911 additional changes omitted for project

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
AIR311 1827 1827 0 0 0
AIR301 134 0 134 0 0

@Lee-W Lee-W changed the title Add air311 rules [airflow] extend AIR311 rules Apr 16, 2025
@Lee-W Lee-W changed the title [airflow] extend AIR311 rules [ airflow ] extend AIR311 rules Apr 16, 2025
@Lee-W Lee-W marked this pull request as ready for review April 16, 2025 10:08
@Lee-W Lee-W mentioned this pull request Apr 16, 2025
2 tasks
@Lee-W Lee-W force-pushed the add-AIR311-rules branch from 4bb2d57 to cd3949e Compare April 16, 2025 14:49
Lee-W added 2 commits April 16, 2025 23:08
* `airflow.io.path.ObjectStoragePath` → `airflow.sdk.ObjectStoragePath`
* `airflow.io.storage.attach` → `airflow.sdk.io.attach`
* `airflow.models.dag.DAG` → `airflow.sdk.DAG`
* `airflow.models.DAG` → `airflow.sdk.DAG`
* `airflow.decorators.dag` → `airflow.sdk.dag`
* `airflow.decorators.task` → `airflow.sdk.task`
* `airflow.decorators.task_group` → `airflow.sdk.task_group`
* `airflow.decorators.setup` → `airflow.sdk.setup`
* `airflow.decorators.teardown` → `airflow.sdk.teardown`
@Lee-W Lee-W force-pushed the add-AIR311-rules branch from cd3949e to 024d430 Compare April 16, 2025 15:08
Copy link
Contributor

@ntBre ntBre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this one looks good to me!

@ntBre ntBre added rule Implementing or modifying a lint rule preview Related to preview mode features labels Apr 16, 2025
@ntBre ntBre changed the title [ airflow ] extend AIR311 rules [airflow] extend AIR311 rules Apr 16, 2025
@ntBre ntBre changed the title [airflow] extend AIR311 rules [airflow] Extend AIR311 rules Apr 16, 2025
@ntBre ntBre merged commit 1a79722 into astral-sh:main Apr 16, 2025
22 checks passed
dcreager added a commit that referenced this pull request Apr 16, 2025
* main: (44 commits)
  [`airflow`] Extend `AIR311` rules (#17422)
  [red-knot] simplify union size limit handling (#17429)
  [`airflow`] Extract `AIR311` from `AIR301` rules (`AIR301`, `AIR311`) (#17310)
  [red-knot] set a size limit on unions of literals (#17419)
  [red-knot] make large-union benchmark slow again (#17418)
  [red-knot] optimize building large unions of literals (#17403)
  [red-knot] Fix comments in type_api.md (#17425)
  [red-knot] Do not assume that `x != 0` if `x` inhabits `~Literal[0]` (#17370)
  [red-knot] make large-union benchmark more challenging (#17416)
  [red-knot] Acknowledge that `T & anything` is assignable to `T` (#17413)
  Update Rust crate clap to v4.5.36 (#17381)
  Raise syntax error when `\` is at end of file (#17409)
  [red-knot] Add regression tests for narrowing constraints cycles (#17408)
  [red-knot] Add some knowledge of `__all__` to `*`-import machinery (#17373)
  Update taiki-e/install-action digest to be7c31b (#17379)
  Update Rust crate mimalloc to v0.1.46 (#17382)
  Update PyO3/maturin-action action to v1.49.1 (#17384)
  Update Rust crate anyhow to v1.0.98 (#17380)
  dependencies: switch from `chrono` to `jiff`
  Update Rust crate bstr to v1.12.0 (#17385)
  ...
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