mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +00:00

## Summary This PR makes changes to the `AIR001` rule as per https://github.com/astral-sh/ruff/pull/14627#discussion_r1860212307. Additionally, * Avoid returning the `Diagnostic` and update the checker in the rule logic for consistency * Remove test case for different keyword position (I don't think it's required here) ## Test Plan Add test cases for multiple operators from various modules.
22 lines
822 B
Python
22 lines
822 B
Python
from airflow.operators import PythonOperator
|
|
from airflow.providers.airbyte.operators.airbyte import AirbyteTriggerSyncOperator
|
|
from airflow.providers.amazon.aws.operators.appflow import AppflowFlowRunOperator
|
|
|
|
|
|
def my_callable():
|
|
pass
|
|
|
|
|
|
my_task = PythonOperator(task_id="my_task", callable=my_callable)
|
|
incorrect_name = PythonOperator(task_id="my_task") # AIR001
|
|
|
|
my_task = AirbyteTriggerSyncOperator(task_id="my_task", callable=my_callable)
|
|
incorrect_name = AirbyteTriggerSyncOperator(task_id="my_task") # AIR001
|
|
|
|
my_task = AppflowFlowRunOperator(task_id="my_task", callable=my_callable)
|
|
incorrect_name = AppflowFlowRunOperator(task_id="my_task") # AIR001
|
|
|
|
# Consider only from the `airflow.operators` (or providers operators) module
|
|
from airflow import MyOperator
|
|
|
|
incorrect_name = MyOperator(task_id="my_task")
|