Skip to content

Comments

[airflow] Move AIR301 to AIR002#16978

Merged
dhruvmanila merged 3 commits intoastral-sh:mainfrom
astronomer:move-AIR301-to-AIR201
Apr 2, 2025
Merged

[airflow] Move AIR301 to AIR002#16978
dhruvmanila merged 3 commits intoastral-sh:mainfrom
astronomer:move-AIR301-to-AIR201

Conversation

@Lee-W
Copy link
Contributor

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

Summary

Unlike other AIR3XX rules, this best practice can be applied to Airflow 1 and Airflow 2 as well. Thus, we think it might make sense for use to move it to AIR002 so that the first number of the error align to Airflow version as possible to reduce confusion

Test Plan

the test fixture has been updated

@github-actions
Copy link
Contributor

github-actions bot commented Mar 26, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

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

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

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

+ airflow-core/src/airflow/models/dag.py:301:16: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/src/airflow/models/dag.py:301:16: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/integration/executors/test_celery_executor.py:240:21: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/integration/executors/test_celery_executor.py:240:21: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/integration/executors/test_celery_executor.py:276:21: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/integration/executors/test_celery_executor.py:276:21: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/dag_processing/test_collection.py:283:15: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/dag_processing/test_collection.py:283:15: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/dag_processing/test_collection.py:369:15: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/dag_processing/test_collection.py:369:15: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/dag_processing/test_collection.py:387:15: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/dag_processing/test_collection.py:387:15: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/dag_processing/test_collection.py:481:15: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/dag_processing/test_collection.py:481:15: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/dag_processing/test_processor.py:141:18: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/dag_processing/test_processor.py:141:18: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/dag_processing/test_processor.py:167:18: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/dag_processing/test_processor.py:167:18: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/dag_processing/test_processor.py:191:18: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/dag_processing/test_processor.py:191:18: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/dag_processing/test_processor.py:218:18: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/dag_processing/test_processor.py:218:18: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/dag_processing/test_processor.py:305:11: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/dag_processing/test_processor.py:305:11: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/dag_processing/test_processor.py:340:10: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/dag_processing/test_processor.py:340:10: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/jobs/test_scheduler_job.py:6261:16: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/jobs/test_scheduler_job.py:6261:16: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/models/test_dag.py:2180:15: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/models/test_dag.py:2180:15: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/models/test_dag.py:2189:15: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/models/test_dag.py:2189:15: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/models/test_dag.py:2879:10: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/models/test_dag.py:2879:10: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/models/test_dagbag.py:934:14: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/models/test_dagbag.py:934:14: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/serialization/test_serialized_objects.py:143:18: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/serialization/test_serialized_objects.py:143:18: AIR301 DAG should have an explicit `schedule` argument
+ airflow-core/tests/unit/serialization/test_serialized_objects.py:238:21: AIR002 DAG should have an explicit `schedule` argument
- airflow-core/tests/unit/serialization/test_serialized_objects.py:238:21: AIR301 DAG should have an explicit `schedule` argument
+ devel-common/src/tests_common/pytest_plugin.py:1929:19: AIR002 DAG should have an explicit `schedule` argument
- devel-common/src/tests_common/pytest_plugin.py:1929:19: AIR301 DAG should have an explicit `schedule` argument
+ devel-common/src/tests_common/pytest_plugin.py:2054:19: AIR002 DAG should have an explicit `schedule` argument
- devel-common/src/tests_common/pytest_plugin.py:2054:19: AIR301 DAG should have an explicit `schedule` argument
+ providers/apache/kafka/tests/system/apache/kafka/example_dag_event_listener.py:85:6: AIR002 DAG should have an explicit `schedule` argument
- providers/apache/kafka/tests/system/apache/kafka/example_dag_event_listener.py:85:6: AIR301 DAG should have an explicit `schedule` argument
+ providers/arangodb/src/airflow/providers/arangodb/example_dags/example_arangodb.py:25:7: AIR002 DAG should have an explicit `schedule` argument
- providers/arangodb/src/airflow/providers/arangodb/example_dags/example_arangodb.py:25:7: AIR301 DAG should have an explicit `schedule` argument
+ providers/asana/tests/system/asana/example_asana.py:49:6: AIR002 DAG should have an explicit `schedule` argument
- providers/asana/tests/system/asana/example_asana.py:49:6: AIR301 DAG should have an explicit `schedule` argument
... 176 additional changes omitted for project

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
AIR002 113 113 0 0 0
AIR301 113 0 113 0 0

@Lee-W Lee-W mentioned this pull request Mar 26, 2025
2 tasks
@ntBre ntBre added rule Implementing or modifying a lint rule preview Related to preview mode features labels Mar 26, 2025
@Lee-W Lee-W force-pushed the move-AIR301-to-AIR201 branch from 047e0b3 to fbbbf99 Compare March 27, 2025 03:51
@uranusjr
Copy link
Contributor

Arguably this even applies to 1.x? Although nobody in their right minds should care about 1.x in 2025. What I’m trying to say is, maybe this makes even more sense as AIR002?

@Lee-W
Copy link
Contributor Author

Lee-W commented Mar 27, 2025

Arguably this even applies to 1.x? Although nobody in their right minds should care about 1.x in 2025. What I’m trying to say is, maybe this makes even more sense as AIR002?

I thought we're using schedule_interval in 1.x?

@Lee-W
Copy link
Contributor Author

Lee-W commented Mar 27, 2025

Arguably this even applies to 1.x? Although nobody in their right minds should care about 1.x in 2025. What I’m trying to say is, maybe this makes even more sense as AIR002?

I thought we're using schedule_interval in 1.x?

oh, looking into the code again. yep. schedule_interval is checked as well.

@Lee-W
Copy link
Contributor Author

Lee-W commented Mar 27, 2025

probably need to tweak the description a bit.

@Lee-W Lee-W changed the title [airflow] move AIR301 to AIR201 [airflow] move AIR301 to AIR102 Mar 27, 2025
@Lee-W Lee-W changed the title [airflow] move AIR301 to AIR102 [airflow] move AIR301 to AIR002 Mar 27, 2025
@Lee-W Lee-W force-pushed the move-AIR301-to-AIR201 branch from c967397 to d0ab79f Compare March 28, 2025 05:16
Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

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

Thanks!

@dhruvmanila dhruvmanila changed the title [airflow] move AIR301 to AIR002 [airflow] Move AIR301 to AIR002 Mar 31, 2025
@Lee-W Lee-W force-pushed the move-AIR301-to-AIR201 branch from d0ab79f to 6f49dc2 Compare April 1, 2025 03:03
Lee-W added 3 commits April 2, 2025 18:03
unlike other AIR3XX, this best practice can be applied to Airflow 2 as well.
Thus, we think it might make sense for use to move it to AIR2xx so that
we the first number of the error align to Airflow version as possible to reduce confusion
@Lee-W Lee-W force-pushed the move-AIR301-to-AIR201 branch from 6f49dc2 to 55c2995 Compare April 2, 2025 10:03
@dhruvmanila dhruvmanila merged commit 33bd08f 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
  ...
maxmynter pushed a commit to maxmynter/ruff that referenced this pull request Apr 3, 2025
## Summary

Unlike other AIR3XX rules, this best practice can be applied to Airflow
1 and Airflow 2 as well. Thus, we think it might make sense for use to
move it to AIR002 so that the first number of the error align to Airflow
version as possible to reduce confusion

## Test Plan

the test fixture has been 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.

4 participants