mirror of https://github.com/astral-sh/ruff
[`airflow`] Extend `AIR301` rule (#17598)
## Summary <!-- What's the purpose of the change? What does it do, and why? --> Add "airflow.operators.python.get_current_context" → "airflow.sdk.get_current_context" rule ## Test Plan <!-- How was it tested? --> the test fixture has been updated accordingly
This commit is contained in:
parent
b6281a8805
commit
aba21a5d47
|
|
@ -150,3 +150,8 @@ has_access
|
|||
# airflow.www.utils
|
||||
get_sensitive_variables_fields
|
||||
should_hide_value_for_key
|
||||
|
||||
# airflow.operators.python
|
||||
from airflow.operators.python import get_current_context
|
||||
|
||||
get_current_context()
|
||||
|
|
|
|||
|
|
@ -672,6 +672,10 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
|
|||
["airflow", "operators", "subdag", ..] => {
|
||||
Replacement::Message("The whole `airflow.subdag` module has been removed.")
|
||||
}
|
||||
["airflow", "operators", "python", "get_current_context"] => Replacement::AutoImport {
|
||||
module: "airflow.sdk",
|
||||
name: "get_current_context",
|
||||
},
|
||||
|
||||
// airflow.secrets
|
||||
["airflow", "secrets", "local_filesystem", "load_connections"] => Replacement::AutoImport {
|
||||
|
|
|
|||
|
|
@ -433,5 +433,16 @@ AIR301_names.py:152:1: AIR301 `airflow.www.utils.should_hide_value_for_key` is r
|
|||
151 | get_sensitive_variables_fields
|
||||
152 | should_hide_value_for_key
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
153 |
|
||||
154 | # airflow.operators.python
|
||||
|
|
||||
= help: Use `airflow.utils.log.secrets_masker.should_hide_value_for_key` instead
|
||||
|
||||
AIR301_names.py:157:1: AIR301 `airflow.operators.python.get_current_context` is removed in Airflow 3.0
|
||||
|
|
||||
155 | from airflow.operators.python import get_current_context
|
||||
156 |
|
||||
157 | get_current_context()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `airflow.sdk.get_current_context` instead
|
||||
|
|
|
|||
Loading…
Reference in New Issue