[airflow] Improve the AIR002 error message (#20173)

<!--
Thank you for contributing to Ruff/ty! 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? (Please prefix
with `[ty]` for ty pull
  requests.)
- Does this pull request include references to any relevant issues?
-->

## Summary

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


### What
Change the message from "DAG should have an explicit `schedule`
argument" to "`DAG` or `@dag` should have an explicit `schedule`
argument"

### Why
We're trying to get rid of the idea that DAG in airflow was Directed
acyclic graph. Thus, change it to refer to the class `DAG` or the
decorator `@dag` might help a bit.

## Test Plan

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

update the test fixtures accordly
This commit is contained in:
Wei Lee 2025-09-03 21:22:56 +08:00 committed by GitHub
parent aee9350df1
commit 3b913ce652
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -46,7 +46,7 @@ pub(crate) struct AirflowDagNoScheduleArgument;
impl Violation for AirflowDagNoScheduleArgument { impl Violation for AirflowDagNoScheduleArgument {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
"DAG should have an explicit `schedule` argument".to_string() "`DAG` or `@dag` should have an explicit `schedule` argument".to_string()
} }
} }

View file

@ -1,7 +1,7 @@
--- ---
source: crates/ruff_linter/src/rules/airflow/mod.rs source: crates/ruff_linter/src/rules/airflow/mod.rs
--- ---
AIR002 DAG should have an explicit `schedule` argument AIR002 `DAG` or `@dag` should have an explicit `schedule` argument
--> AIR002.py:4:1 --> AIR002.py:4:1
| |
2 | from airflow.timetables.simple import NullTimetable 2 | from airflow.timetables.simple import NullTimetable
@ -12,7 +12,7 @@ AIR002 DAG should have an explicit `schedule` argument
6 | DAG(dag_id="class_schedule", schedule="@hourly") 6 | DAG(dag_id="class_schedule", schedule="@hourly")
| |
AIR002 DAG should have an explicit `schedule` argument AIR002 `DAG` or `@dag` should have an explicit `schedule` argument
--> AIR002.py:13:2 --> AIR002.py:13:2
| |
13 | @dag() 13 | @dag()