Skip to content

Conversation

@Lee-W
Copy link
Contributor

@Lee-W Lee-W commented May 6, 2025

Summary

If a try-catch block guards the names, we don't raise warnings. During this change, I discovered that some of the replacement types were missed. Thus, I extend the fix to types other than AutoImport as well

Test Plan

Test fixtures are added and updated.

@github-actions
Copy link
Contributor

github-actions bot commented May 6, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

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

apache/airflow (+0 -33 violations, +270 -0 fixes)

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

+ airflow-core/src/airflow/models/baseoperator.py:301:26: 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/models/baseoperator.py:301:26: 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/models/baseoperator.py:305:28: 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/models/baseoperator.py:305:28: 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/models/baseoperator.py:382:41: 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/models/baseoperator.py:382:41: 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/models/baseoperator.py:433:41: 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/models/baseoperator.py:433:41: 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/models/dagbag.py:474:95: 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/models/dagbag.py:474:95: 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/models/dagrun.py:1261:50: 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/models/dagrun.py:1261:50: 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/models/dagrun.py:1575:20: 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/models/dagrun.py:1575:20: 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/models/dagrun.py:1975:36: 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/models/dagrun.py:1975:36: 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/models/dagrun.py:206: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/models/dagrun.py:206: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/models/dagrun.py:208: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/models/dagrun.py:208: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/models/dagrun.py:861:26: 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/models/dagrun.py:861:26: 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/models/taskmap.py:172:65: 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/models/taskmap.py:172:65: 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/models/xcom_arg.py:100:54: 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/models/xcom_arg.py:100:54: 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.
... 273 additional changes omitted for rule AIR311
- airflow-core/tests/unit/utils/test_dot_renderer.py:103:22: AIR312 `airflow.operators.python.PythonOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
- airflow-core/tests/unit/utils/test_dot_renderer.py:83:22: AIR312 `airflow.operators.python.PythonOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
- providers/edge3/src/airflow/providers/edge3/example_dags/integration_test.py:129:24: AIR312 `airflow.operators.bash.BashOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
- providers/edge3/src/airflow/providers/edge3/example_dags/integration_test.py:133:17: AIR312 `airflow.operators.empty.EmptyOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
- providers/edge3/src/airflow/providers/edge3/example_dags/integration_test.py:138:22: AIR312 `airflow.operators.python.PythonOperator` is deprecated and moved into `standard` provider in Airflow 3.0; It still works in Airflow 3.0 but is expected to be removed in a future version.
... 272 additional changes omitted for project

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
AIR311 298 0 28 270 0
AIR312 5 0 5 0 0

@Lee-W Lee-W force-pushed the apply-try-catch-guard-to-all-AIR3 branch from d838dd5 to 58fd21c Compare May 6, 2025 13:49
@MichaReiser MichaReiser added rule Implementing or modifying a lint rule preview Related to preview mode features labels May 7, 2025
@MichaReiser
Copy link
Member

Can you explain to me why this pr increases the number of fixes for AIR311? Does this PR contain an other change that should be mentioned in the PR summary.

@Lee-W Lee-W marked this pull request as draft May 7, 2025 07:48
@Lee-W
Copy link
Contributor Author

Lee-W commented May 7, 2025

Can you explain to me why this pr increases the number of fixes for AIR311? Does this PR contain an other change that should be mentioned in the PR summary.

Let me take another look. I just mark this one as draft

@Lee-W Lee-W force-pushed the apply-try-catch-guard-to-all-AIR3 branch 2 times, most recently from 5da9840 to 0af1182 Compare May 7, 2025 12:54
@Lee-W
Copy link
Contributor Author

Lee-W commented May 7, 2025

Just found the reason. Some replacement types were missed in the previous version. Let me update the description.

@Lee-W Lee-W marked this pull request as ready for review May 7, 2025 13:06
@Lee-W Lee-W mentioned this pull request May 7, 2025
2 tasks
@MichaReiser MichaReiser requested a review from ntBre May 9, 2025 06:29
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.

Looks good, just one suggestion that might not be worth handling.

@Lee-W Lee-W force-pushed the apply-try-catch-guard-to-all-AIR3 branch from 0af1182 to b5644e8 Compare May 12, 2025 10:50
@ntBre ntBre merged commit 2eb2d53 into astral-sh:main May 12, 2025
34 checks passed
dcreager added a commit that referenced this pull request May 13, 2025
…eepish

* origin/main:
  [ty] Induct into instances and subclasses when finding and applying generics (#18052)
  [ty] Allow classes to inherit from `type[Any]` or `type[Unknown]` (#18060)
  [ty] Allow a class to inherit from an intersection if the intersection contains a dynamic type and the intersection is not disjoint from `type` (#18055)
  [ty] Narrowing for `hasattr()` (#18053)
  Update reference documentation for `--python-version` (#18056)
  [`flake8-bugbear`] Ignore `B028` if `skip_file_prefixes` is present (#18047)
  [`airflow`] Apply try-catch guard to all AIR3 rules (`AIR3`) (#17887)
  [`pylint`] add fix safety section (`PLW3301`) (#17878)
  Update `--python` to accept paths to executables in virtual environments (#17954)
  [`pylint`] add fix safety section (`PLE4703`) (#17824)
  [`ruff`] Implement a recursive check for `RUF060` (#17976)
  [`flake8-use-pathlib`] `PTH*` suppress diagnostic for all `os.*` functions that have the `dir_fd` parameter (#17968)
  [`refurb`] Mark autofix as safe only for number literals in `FURB116` (#17692)
  [`flake8-simplify`] Fix `SIM905` autofix for `rsplit` creating a reversed list literal (#18045)
  Avoid initializing progress bars early (#18049)
dcreager added a commit that referenced this pull request May 13, 2025
…eep-dish

* origin/main:
  [ty] Infer parameter specializations of generic aliases (#18021)
  [ty] Understand homogeneous tuple annotations (#17998)
  [ty] Induct into instances and subclasses when finding and applying generics (#18052)
  [ty] Allow classes to inherit from `type[Any]` or `type[Unknown]` (#18060)
  [ty] Allow a class to inherit from an intersection if the intersection contains a dynamic type and the intersection is not disjoint from `type` (#18055)
  [ty] Narrowing for `hasattr()` (#18053)
  Update reference documentation for `--python-version` (#18056)
  [`flake8-bugbear`] Ignore `B028` if `skip_file_prefixes` is present (#18047)
  [`airflow`] Apply try-catch guard to all AIR3 rules (`AIR3`) (#17887)
  [`pylint`] add fix safety section (`PLW3301`) (#17878)
  Update `--python` to accept paths to executables in virtual environments (#17954)
  [`pylint`] add fix safety section (`PLE4703`) (#17824)
  [`ruff`] Implement a recursive check for `RUF060` (#17976)
  [`flake8-use-pathlib`] `PTH*` suppress diagnostic for all `os.*` functions that have the `dir_fd` parameter (#17968)
  [`refurb`] Mark autofix as safe only for number literals in `FURB116` (#17692)
  [`flake8-simplify`] Fix `SIM905` autofix for `rsplit` creating a reversed list literal (#18045)
  Avoid initializing progress bars early (#18049)
Glyphack pushed a commit to Glyphack/ruff that referenced this pull request May 21, 2025
…sh#17887)

<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

<!-- What's the purpose of the change? What does it do, and why? -->

If a try-catch block guards the names, we don't raise warnings. During
this change, I discovered that some of the replacement types were
missed. Thus, I extend the fix to types other than AutoImport as well

## Test Plan

<!-- How was it tested? -->

Test fixtures are added and updated.
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.

3 participants