Skip to content

Commit 68f98cf

Browse files
authored
[Airflow] Make AIR312 example error out-of-the-box (astral-sh#18989)
## Summary Part of astral-sh#18972 This PR makes [airflow3-suggested-to-move-to-provider (AIR312)](https://docs.astral.sh/ruff/rules/airflow3-suggested-to-move-to-provider/#airflow3-suggested-to-move-to-provider-air312)'s example error out-of-the-box [Old example](https://play.ruff.rs/1be0d654-1ed5-4a0b-8791-cc5db73333d5) ```py from airflow.operators.python import PythonOperator ``` [New example](https://play.ruff.rs/b6260206-fa19-4ab2-8d45-ddd43c46a759) ```py from airflow.operators.python import PythonOperator def print_context(ds=None, **kwargs): print(kwargs) print(ds) print_the_context = PythonOperator( task_id="print_the_context", python_callable=print_context ) ``` ## Test Plan <!-- How was it tested? --> N/A, no functionality/tests affected
1 parent 315adba commit 68f98cf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

crates/ruff_linter/src/rules/airflow/rules/suggested_to_move_to_provider_in_3.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,31 @@ use ruff_text_size::TextRange;
2424
/// ## Example
2525
/// ```python
2626
/// from airflow.operators.python import PythonOperator
27+
///
28+
///
29+
/// def print_context(ds=None, **kwargs):
30+
/// print(kwargs)
31+
/// print(ds)
32+
///
33+
///
34+
/// print_the_context = PythonOperator(
35+
/// task_id="print_the_context", python_callable=print_context
36+
/// )
2737
/// ```
2838
///
2939
/// Use instead:
3040
/// ```python
3141
/// from airflow.providers.standard.operators.python import PythonOperator
42+
///
43+
///
44+
/// def print_context(ds=None, **kwargs):
45+
/// print(kwargs)
46+
/// print(ds)
47+
///
48+
///
49+
/// print_the_context = PythonOperator(
50+
/// task_id="print_the_context", python_callable=print_context
51+
/// )
3252
/// ```
3353
#[derive(ViolationMetadata)]
3454
pub(crate) struct Airflow3SuggestedToMoveToProvider<'a> {

0 commit comments

Comments
 (0)