ruff/crates
Wei Lee 3445d1322d
[airflow] Add unsafe fix module moved cases (AIR302) (#18093)
<!--
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? -->

Add utility functions `generate_import_edit` and
`generate_remove_and_runtime_import_edit` to generate the fix needed for
the airflow rules.

1. `generate_import_edit` is for the cases where the member name has
changed. (e.g., `airflow.datasts.Dataset` to `airflow.sdk.Asset`) It's
just extracted from the original logic
2. `generate_remove_and_runtime_import_edit` is for cases where the
member name has not changed. (e.g.,
`airflow.operators.pig_operator.PigOperator` to
`airflow.providers.apache.pig.hooks.pig.PigCliHook`) This is newly
introduced. As it introduced runtime import, I mark it as an unsafe fix.
Under the hook, it tried to find the original import statement, remove
it, and add a new import fix

---

* rules fix
* `airflow.sensors.external_task_sensor.ExternalTaskSensorLink` →
`airflow.providers.standard.sensors.external_task.ExternalDagLink`

## Test Plan

<!-- How was it tested? -->
The existing test fixtures have been updated
2025-05-29 16:30:40 -04:00
..
ruff Rename ruff_linter::Diagnostic to OldDiagnostic (#18355) 2025-05-29 15:04:31 -04:00
ruff_annotate_snippets Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_benchmark [ty] Add --config-file CLI arg (#18083) 2025-05-27 08:00:38 +02:00
ruff_cache Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_db [ty] Support ephemeral uv virtual environments (#18335) 2025-05-28 14:54:59 +00:00
ruff_dev Add a ViolationMetadata::rule method (#18234) 2025-05-28 09:27:09 -04:00
ruff_diagnostics Add a ViolationMetadata::rule method (#18234) 2025-05-28 09:27:09 -04:00
ruff_formatter Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_graph [ty] Tell the user why we inferred the Python version we inferred (#18082) 2025-05-21 11:06:27 -04:00
ruff_index Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_linter [airflow] Add unsafe fix module moved cases (AIR302) (#18093) 2025-05-29 16:30:40 -04:00
ruff_macros Add a ViolationMetadata::rule method (#18234) 2025-05-28 09:27:09 -04:00
ruff_notebook Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_options_metadata [ty] Document configuration schema (#17950) 2025-05-09 10:47:45 +02:00
ruff_python_ast ty_ide: improve completions by using scopes 2025-05-29 10:31:30 -04:00
ruff_python_ast_integration_tests Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_codegen Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_formatter Preserve tuple parentheses in case patterns (#18147) 2025-05-22 07:52:21 +02:00
ruff_python_index Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_literal Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_parser ruff_python_parser: add Tokens::before method 2025-05-29 10:31:30 -04:00
ruff_python_resolver Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_semantic Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_stdlib Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_python_trivia Add offset method to ruff_python_trivia::Cursor (#18371) 2025-05-29 16:08:15 +01:00
ruff_python_trivia_integration_tests Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_server Add a ViolationMetadata::rule method (#18234) 2025-05-28 09:27:09 -04:00
ruff_source_file Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ruff_text_size Add rustfmt.toml file (#18197) 2025-05-19 11:40:58 -04:00
ruff_wasm Bump 0.11.12 (#18369) 2025-05-29 09:17:12 -04:00
ruff_workspace Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
ty [ty] Split Type::KnownInstance into two type variants (#18350) 2025-05-29 14:47:55 +01:00
ty_ide ty_ide: improve completions by using scopes 2025-05-29 10:31:30 -04:00
ty_project [ty] Support publishing diagnostics in the server (#18309) 2025-05-28 13:15:11 +05:30
ty_python_semantic ty_ide: improve completions by using scopes 2025-05-29 10:31:30 -04:00
ty_server [ty] Support cancellation and retry in the server (#18273) 2025-05-28 10:59:29 +02:00
ty_test Add offset method to ruff_python_trivia::Cursor (#18371) 2025-05-29 16:08:15 +01:00
ty_vendored [ty] Type compendium (#18263) 2025-05-23 11:41:31 +02:00
ty_wasm [ty] Gracefully handle salsa cancellations and panics in background request handlers (#18254) 2025-05-26 13:37:49 +01:00