Compare commits
1 Commits
ag/fix-com
...
david/fix-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49c077d5d4 |
4
.github/workflows/build-docker.yml
vendored
4
.github/workflows/build-docker.yml
vendored
@@ -79,7 +79,7 @@ jobs:
|
||||
# Adapted from https://docs.docker.com/build/ci/github-actions/multi-platform/
|
||||
- name: Build and push by digest
|
||||
id: build
|
||||
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
|
||||
uses: docker/build-push-action@1dc73863535b631f98b2378be8619f83b136f4a0 # v6.17.0
|
||||
with:
|
||||
context: .
|
||||
platforms: ${{ matrix.platform }}
|
||||
@@ -231,7 +231,7 @@ jobs:
|
||||
${{ env.TAG_PATTERNS }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
|
||||
uses: docker/build-push-action@1dc73863535b631f98b2378be8619f83b136f4a0 # v6.17.0
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
20
.github/workflows/ci.yaml
vendored
20
.github/workflows/ci.yaml
vendored
@@ -239,11 +239,11 @@ jobs:
|
||||
- name: "Install mold"
|
||||
uses: rui314/setup-mold@67424c1b3680e35255d95971cbd5de0047bf31c3 # v1
|
||||
- name: "Install cargo nextest"
|
||||
uses: taiki-e/install-action@735e5933943122c5ac182670a935f54a949265c1 # v2.52.4
|
||||
uses: taiki-e/install-action@6c6479b49816fcc0975a31af977bdc1f847c2920 # v2.52.1
|
||||
with:
|
||||
tool: cargo-nextest
|
||||
- name: "Install cargo insta"
|
||||
uses: taiki-e/install-action@735e5933943122c5ac182670a935f54a949265c1 # v2.52.4
|
||||
uses: taiki-e/install-action@6c6479b49816fcc0975a31af977bdc1f847c2920 # v2.52.1
|
||||
with:
|
||||
tool: cargo-insta
|
||||
- name: ty mdtests (GitHub annotations)
|
||||
@@ -297,11 +297,11 @@ jobs:
|
||||
- name: "Install mold"
|
||||
uses: rui314/setup-mold@67424c1b3680e35255d95971cbd5de0047bf31c3 # v1
|
||||
- name: "Install cargo nextest"
|
||||
uses: taiki-e/install-action@735e5933943122c5ac182670a935f54a949265c1 # v2.52.4
|
||||
uses: taiki-e/install-action@6c6479b49816fcc0975a31af977bdc1f847c2920 # v2.52.1
|
||||
with:
|
||||
tool: cargo-nextest
|
||||
- name: "Install cargo insta"
|
||||
uses: taiki-e/install-action@735e5933943122c5ac182670a935f54a949265c1 # v2.52.4
|
||||
uses: taiki-e/install-action@6c6479b49816fcc0975a31af977bdc1f847c2920 # v2.52.1
|
||||
with:
|
||||
tool: cargo-insta
|
||||
- name: "Run tests"
|
||||
@@ -324,7 +324,7 @@ jobs:
|
||||
- name: "Install Rust toolchain"
|
||||
run: rustup show
|
||||
- name: "Install cargo nextest"
|
||||
uses: taiki-e/install-action@735e5933943122c5ac182670a935f54a949265c1 # v2.52.4
|
||||
uses: taiki-e/install-action@6c6479b49816fcc0975a31af977bdc1f847c2920 # v2.52.1
|
||||
with:
|
||||
tool: cargo-nextest
|
||||
- name: "Run tests"
|
||||
@@ -407,11 +407,11 @@ jobs:
|
||||
- name: "Install mold"
|
||||
uses: rui314/setup-mold@67424c1b3680e35255d95971cbd5de0047bf31c3 # v1
|
||||
- name: "Install cargo nextest"
|
||||
uses: taiki-e/install-action@735e5933943122c5ac182670a935f54a949265c1 # v2.52.4
|
||||
uses: taiki-e/install-action@6c6479b49816fcc0975a31af977bdc1f847c2920 # v2.52.1
|
||||
with:
|
||||
tool: cargo-nextest
|
||||
- name: "Install cargo insta"
|
||||
uses: taiki-e/install-action@735e5933943122c5ac182670a935f54a949265c1 # v2.52.4
|
||||
uses: taiki-e/install-action@6c6479b49816fcc0975a31af977bdc1f847c2920 # v2.52.1
|
||||
with:
|
||||
tool: cargo-insta
|
||||
- name: "Run tests"
|
||||
@@ -437,7 +437,7 @@ jobs:
|
||||
- name: "Install Rust toolchain"
|
||||
run: rustup show
|
||||
- name: "Install cargo-binstall"
|
||||
uses: cargo-bins/cargo-binstall@e8c9cc3599f6c4063d143083205f98ca25d91677 # v1.12.6
|
||||
uses: cargo-bins/cargo-binstall@5cbf019d8cb9b9d5b086218c41458ea35d817691 # v1.12.5
|
||||
with:
|
||||
tool: cargo-fuzz@0.11.2
|
||||
- name: "Install cargo-fuzz"
|
||||
@@ -690,7 +690,7 @@ jobs:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: cargo-bins/cargo-binstall@e8c9cc3599f6c4063d143083205f98ca25d91677 # v1.12.6
|
||||
- uses: cargo-bins/cargo-binstall@5cbf019d8cb9b9d5b086218c41458ea35d817691 # v1.12.5
|
||||
- run: cargo binstall --no-confirm cargo-shear
|
||||
- run: cargo shear
|
||||
|
||||
@@ -910,7 +910,7 @@ jobs:
|
||||
run: rustup show
|
||||
|
||||
- name: "Install codspeed"
|
||||
uses: taiki-e/install-action@735e5933943122c5ac182670a935f54a949265c1 # v2.52.4
|
||||
uses: taiki-e/install-action@6c6479b49816fcc0975a31af977bdc1f847c2920 # v2.52.1
|
||||
with:
|
||||
tool: cargo-codspeed
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ repos:
|
||||
pass_filenames: false # This makes it a lot faster
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.11.12
|
||||
rev: v0.11.11
|
||||
hooks:
|
||||
- id: ruff-format
|
||||
- id: ruff
|
||||
@@ -98,7 +98,7 @@ repos:
|
||||
# zizmor detects security vulnerabilities in GitHub Actions workflows.
|
||||
# Additional configuration for the tool is found in `.github/zizmor.yml`
|
||||
- repo: https://github.com/woodruffw/zizmor-pre-commit
|
||||
rev: v1.9.0
|
||||
rev: v1.8.0
|
||||
hooks:
|
||||
- id: zizmor
|
||||
|
||||
|
||||
28
CHANGELOG.md
28
CHANGELOG.md
@@ -1,33 +1,5 @@
|
||||
# Changelog
|
||||
|
||||
## 0.11.12
|
||||
|
||||
### Preview features
|
||||
|
||||
- \[`airflow`\] Revise fix titles (`AIR3`) ([#18215](https://github.com/astral-sh/ruff/pull/18215))
|
||||
- \[`pylint`\] Implement `missing-maxsplit-arg` (`PLC0207`) ([#17454](https://github.com/astral-sh/ruff/pull/17454))
|
||||
- \[`pyupgrade`\] New rule `UP050` (`useless-class-metaclass-type`) ([#18334](https://github.com/astral-sh/ruff/pull/18334))
|
||||
- \[`flake8-use-pathlib`\] Replace `os.symlink` with `Path.symlink_to` (`PTH211`) ([#18337](https://github.com/astral-sh/ruff/pull/18337))
|
||||
|
||||
### Bug fixes
|
||||
|
||||
- \[`flake8-bugbear`\] Ignore `__debug__` attribute in `B010` ([#18357](https://github.com/astral-sh/ruff/pull/18357))
|
||||
- \[`flake8-async`\] Fix `anyio.sleep` argument name (`ASYNC115`, `ASYNC116`) ([#18262](https://github.com/astral-sh/ruff/pull/18262))
|
||||
- \[`refurb`\] Fix `FURB129` autofix generating invalid syntax ([#18235](https://github.com/astral-sh/ruff/pull/18235))
|
||||
|
||||
### Rule changes
|
||||
|
||||
- \[`flake8-implicit-str-concat`\] Add autofix for `ISC003` ([#18256](https://github.com/astral-sh/ruff/pull/18256))
|
||||
- \[`pycodestyle`\] Improve the diagnostic message for `E712` ([#18328](https://github.com/astral-sh/ruff/pull/18328))
|
||||
- \[`flake8-2020`\] Fix diagnostic message for `!=` comparisons (`YTT201`) ([#18293](https://github.com/astral-sh/ruff/pull/18293))
|
||||
- \[`pyupgrade`\] Make fix unsafe if it deletes comments (`UP010`) ([#18291](https://github.com/astral-sh/ruff/pull/18291))
|
||||
|
||||
### Documentation
|
||||
|
||||
- Simplify rules table to improve readability ([#18297](https://github.com/astral-sh/ruff/pull/18297))
|
||||
- Update editor integrations link in README ([#17977](https://github.com/astral-sh/ruff/pull/17977))
|
||||
- \[`flake8-bugbear`\] Add fix safety section (`B006`) ([#17652](https://github.com/astral-sh/ruff/pull/17652))
|
||||
|
||||
## 0.11.11
|
||||
|
||||
### Preview features
|
||||
|
||||
73
Cargo.lock
generated
73
Cargo.lock
generated
@@ -8,18 +8,6 @@ version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
||||
|
||||
[[package]]
|
||||
name = "ahash"
|
||||
version = "0.8.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"once_cell",
|
||||
"version_check",
|
||||
"zerocopy",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.1.3"
|
||||
@@ -354,9 +342,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.5.39"
|
||||
version = "4.5.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f"
|
||||
checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
@@ -364,9 +352,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.5.39"
|
||||
version = "4.5.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51"
|
||||
checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
@@ -498,7 +486,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
|
||||
dependencies = [
|
||||
"lazy_static",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -507,7 +495,7 @@ version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fde0e0ec90c9dfb3b4b1a0891a7dcd0e2bffde2f7efed5fe7c9bb00e5bfb915e"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -921,7 +909,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1118,10 +1106,6 @@ name = "hashbrown"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"allocator-api2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
@@ -1460,7 +1444,7 @@ checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9"
|
||||
dependencies = [
|
||||
"hermit-abi 0.5.1",
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1524,7 +1508,7 @@ dependencies = [
|
||||
"portable-atomic",
|
||||
"portable-atomic-util",
|
||||
"serde",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1613,9 +1597,9 @@ checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa"
|
||||
|
||||
[[package]]
|
||||
name = "libcst"
|
||||
version = "1.8.0"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3ac076e37f8fe6bcddbb6c3282897e6e9498b254907ccbfc806dc8f9f1491f02"
|
||||
checksum = "ad9e315e3f679e61b9095ffd5e509de78b8a4ea3bba9d772f6fb243209f808d4"
|
||||
dependencies = [
|
||||
"annotate-snippets",
|
||||
"libcst_derive",
|
||||
@@ -1623,14 +1607,14 @@ dependencies = [
|
||||
"paste",
|
||||
"peg",
|
||||
"regex",
|
||||
"thiserror 2.0.12",
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libcst_derive"
|
||||
version = "1.8.0"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9cf4a12c744a301b216c4f0cb73542709ab15e6dadbb06966ac05864109d05da"
|
||||
checksum = "bfa96ed35d0dccc67cf7ba49350cb86de3dcb1d072a7ab28f99117f19d874953"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
@@ -2501,7 +2485,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ruff"
|
||||
version = "0.11.12"
|
||||
version = "0.11.11"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"argfile",
|
||||
@@ -2658,6 +2642,7 @@ dependencies = [
|
||||
"rayon",
|
||||
"regex",
|
||||
"ruff",
|
||||
"ruff_diagnostics",
|
||||
"ruff_formatter",
|
||||
"ruff_linter",
|
||||
"ruff_notebook",
|
||||
@@ -2687,7 +2672,9 @@ dependencies = [
|
||||
name = "ruff_diagnostics"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"is-macro",
|
||||
"log",
|
||||
"ruff_text_size",
|
||||
"serde",
|
||||
]
|
||||
@@ -2738,7 +2725,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ruff_linter"
|
||||
version = "0.11.12"
|
||||
version = "0.11.11"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"anyhow",
|
||||
@@ -3074,7 +3061,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ruff_wasm"
|
||||
version = "0.11.12"
|
||||
version = "0.11.11"
|
||||
dependencies = [
|
||||
"console_error_panic_hook",
|
||||
"console_log",
|
||||
@@ -3176,7 +3163,7 @@ dependencies = [
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3193,14 +3180,13 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
||||
|
||||
[[package]]
|
||||
name = "salsa"
|
||||
version = "0.22.0"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=2b5188778e91a5ab50cb7d827148caf7eb2f4630#2b5188778e91a5ab50cb7d827148caf7eb2f4630"
|
||||
version = "0.21.1"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=4818b15f3b7516555d39f5a41cb75970448bee4c#4818b15f3b7516555d39f5a41cb75970448bee4c"
|
||||
dependencies = [
|
||||
"boxcar",
|
||||
"compact_str",
|
||||
"crossbeam-queue",
|
||||
"dashmap 6.1.0",
|
||||
"hashbrown 0.14.5",
|
||||
"hashbrown 0.15.3",
|
||||
"hashlink",
|
||||
"indexmap",
|
||||
@@ -3217,13 +3203,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "salsa-macro-rules"
|
||||
version = "0.22.0"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=2b5188778e91a5ab50cb7d827148caf7eb2f4630#2b5188778e91a5ab50cb7d827148caf7eb2f4630"
|
||||
version = "0.21.1"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=4818b15f3b7516555d39f5a41cb75970448bee4c#4818b15f3b7516555d39f5a41cb75970448bee4c"
|
||||
|
||||
[[package]]
|
||||
name = "salsa-macros"
|
||||
version = "0.22.0"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=2b5188778e91a5ab50cb7d827148caf7eb2f4630#2b5188778e91a5ab50cb7d827148caf7eb2f4630"
|
||||
version = "0.21.1"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=4818b15f3b7516555d39f5a41cb75970448bee4c#4818b15f3b7516555d39f5a41cb75970448bee4c"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
@@ -3546,7 +3532,7 @@ dependencies = [
|
||||
"getrandom 0.3.3",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3889,7 +3875,6 @@ dependencies = [
|
||||
"countme",
|
||||
"crossbeam",
|
||||
"ctrlc",
|
||||
"dunce",
|
||||
"filetime",
|
||||
"indicatif",
|
||||
"insta",
|
||||
@@ -4541,7 +4526,7 @@ version = "0.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
|
||||
dependencies = [
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.52.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -129,7 +129,7 @@ regex = { version = "1.10.2" }
|
||||
rustc-hash = { version = "2.0.0" }
|
||||
rustc-stable-hash = { version = "0.1.2" }
|
||||
# When updating salsa, make sure to also update the revision in `fuzz/Cargo.toml`
|
||||
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "2b5188778e91a5ab50cb7d827148caf7eb2f4630" }
|
||||
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "4818b15f3b7516555d39f5a41cb75970448bee4c" }
|
||||
schemars = { version = "0.8.16" }
|
||||
seahash = { version = "4.1.0" }
|
||||
serde = { version = "1.0.197", features = ["derive"] }
|
||||
|
||||
@@ -148,8 +148,8 @@ curl -LsSf https://astral.sh/ruff/install.sh | sh
|
||||
powershell -c "irm https://astral.sh/ruff/install.ps1 | iex"
|
||||
|
||||
# For a specific version.
|
||||
curl -LsSf https://astral.sh/ruff/0.11.12/install.sh | sh
|
||||
powershell -c "irm https://astral.sh/ruff/0.11.12/install.ps1 | iex"
|
||||
curl -LsSf https://astral.sh/ruff/0.11.11/install.sh | sh
|
||||
powershell -c "irm https://astral.sh/ruff/0.11.11/install.ps1 | iex"
|
||||
```
|
||||
|
||||
You can also install Ruff via [Homebrew](https://formulae.brew.sh/formula/ruff), [Conda](https://anaconda.org/conda-forge/ruff),
|
||||
@@ -182,7 +182,7 @@ Ruff can also be used as a [pre-commit](https://pre-commit.com/) hook via [`ruff
|
||||
```yaml
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
# Ruff version.
|
||||
rev: v0.11.12
|
||||
rev: v0.11.11
|
||||
hooks:
|
||||
# Run the linter.
|
||||
- id: ruff
|
||||
|
||||
@@ -4,10 +4,6 @@ extend-exclude = [
|
||||
"crates/ty_vendored/vendor/**/*",
|
||||
"**/resources/**/*",
|
||||
"**/snapshots/**/*",
|
||||
# Completion tests tend to have a lot of incomplete
|
||||
# words naturally. It's annoying to have to make all
|
||||
# of them actually words. So just ignore typos here.
|
||||
"crates/ty_ide/src/completion.rs",
|
||||
]
|
||||
|
||||
[default.extend-words]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ruff"
|
||||
version = "0.11.12"
|
||||
version = "0.11.11"
|
||||
publish = true
|
||||
authors = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
|
||||
@@ -349,6 +349,7 @@ impl FileCache {
|
||||
.iter()
|
||||
.map(|msg| {
|
||||
Message::diagnostic(
|
||||
msg.rule.into(),
|
||||
msg.body.clone(),
|
||||
msg.suggestion.clone(),
|
||||
msg.range,
|
||||
@@ -356,7 +357,6 @@ impl FileCache {
|
||||
msg.parent,
|
||||
file.clone(),
|
||||
msg.noqa_offset,
|
||||
msg.rule,
|
||||
)
|
||||
})
|
||||
.collect()
|
||||
|
||||
@@ -12,7 +12,7 @@ use rayon::prelude::*;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use ruff_db::panic::catch_unwind;
|
||||
use ruff_linter::OldDiagnostic;
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_linter::message::Message;
|
||||
use ruff_linter::package::PackageRoot;
|
||||
use ruff_linter::registry::Rule;
|
||||
@@ -131,7 +131,8 @@ pub(crate) fn check(
|
||||
|
||||
Diagnostics::new(
|
||||
vec![Message::from_diagnostic(
|
||||
OldDiagnostic::new(IOError { message }, TextRange::default(), &dummy),
|
||||
Diagnostic::new(IOError { message }, TextRange::default()),
|
||||
dummy,
|
||||
None,
|
||||
)],
|
||||
FxHashMap::default(),
|
||||
|
||||
@@ -6,7 +6,7 @@ use serde::ser::SerializeSeq;
|
||||
use serde::{Serialize, Serializer};
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use ruff_linter::FixAvailability;
|
||||
use ruff_diagnostics::FixAvailability;
|
||||
use ruff_linter::registry::{Linter, Rule, RuleNamespace};
|
||||
|
||||
use crate::args::HelpFormat;
|
||||
|
||||
@@ -12,7 +12,7 @@ use colored::Colorize;
|
||||
use log::{debug, warn};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use ruff_linter::OldDiagnostic;
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_linter::codes::Rule;
|
||||
use ruff_linter::linter::{FixTable, FixerResult, LinterResult, ParseSource, lint_fix, lint_only};
|
||||
use ruff_linter::message::Message;
|
||||
@@ -64,13 +64,13 @@ impl Diagnostics {
|
||||
let source_file = SourceFileBuilder::new(name, "").finish();
|
||||
Self::new(
|
||||
vec![Message::from_diagnostic(
|
||||
OldDiagnostic::new(
|
||||
Diagnostic::new(
|
||||
IOError {
|
||||
message: err.to_string(),
|
||||
},
|
||||
TextRange::default(),
|
||||
&source_file,
|
||||
),
|
||||
source_file,
|
||||
None,
|
||||
)],
|
||||
FxHashMap::default(),
|
||||
@@ -235,7 +235,7 @@ pub(crate) fn lint_path(
|
||||
};
|
||||
let source_file =
|
||||
SourceFileBuilder::new(path.to_string_lossy(), contents).finish();
|
||||
lint_pyproject_toml(&source_file, settings)
|
||||
lint_pyproject_toml(source_file, settings)
|
||||
} else {
|
||||
vec![]
|
||||
};
|
||||
@@ -396,7 +396,7 @@ pub(crate) fn lint_stdin(
|
||||
}
|
||||
|
||||
return Ok(Diagnostics {
|
||||
messages: lint_pyproject_toml(&source_file, &settings.linter),
|
||||
messages: lint_pyproject_toml(source_file, &settings.linter),
|
||||
fixed: FixMap::from_iter([(fs::relativize_path(path), FixTable::default())]),
|
||||
notebook_indexes: FxHashMap::default(),
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ fn setup_tomllib_case() -> Case {
|
||||
|
||||
let src_root = SystemPath::new("/src");
|
||||
let mut metadata = ProjectMetadata::discover(src_root, &system).unwrap();
|
||||
metadata.apply_options(Options {
|
||||
metadata.apply_cli_options(Options {
|
||||
environment: Some(EnvironmentOptions {
|
||||
python_version: Some(RangedValue::cli(PythonVersion::PY312)),
|
||||
..EnvironmentOptions::default()
|
||||
@@ -224,7 +224,7 @@ fn setup_micro_case(code: &str) -> Case {
|
||||
|
||||
let src_root = SystemPath::new("/src");
|
||||
let mut metadata = ProjectMetadata::discover(src_root, &system).unwrap();
|
||||
metadata.apply_options(Options {
|
||||
metadata.apply_cli_options(Options {
|
||||
environment: Some(EnvironmentOptions {
|
||||
python_version: Some(RangedValue::cli(PythonVersion::PY312)),
|
||||
..EnvironmentOptions::default()
|
||||
|
||||
@@ -596,13 +596,6 @@ impl AsRef<SystemPath> for Utf8PathBuf {
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<SystemPath> for camino::Utf8Component<'_> {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &SystemPath {
|
||||
SystemPath::new(self.as_str())
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<SystemPath> for str {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &SystemPath {
|
||||
@@ -633,22 +626,6 @@ impl Deref for SystemPathBuf {
|
||||
}
|
||||
}
|
||||
|
||||
impl<P: AsRef<SystemPath>> FromIterator<P> for SystemPathBuf {
|
||||
fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> Self {
|
||||
let mut buf = SystemPathBuf::new();
|
||||
buf.extend(iter);
|
||||
buf
|
||||
}
|
||||
}
|
||||
|
||||
impl<P: AsRef<SystemPath>> Extend<P> for SystemPathBuf {
|
||||
fn extend<I: IntoIterator<Item = P>>(&mut self, iter: I) {
|
||||
for path in iter {
|
||||
self.push(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for SystemPath {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
self.0.fmt(f)
|
||||
|
||||
@@ -13,12 +13,12 @@ pub fn assert_function_query_was_not_run<Db, Q, QDb, I, R>(
|
||||
Q: Fn(QDb, I) -> R,
|
||||
I: salsa::plumbing::AsId + std::fmt::Debug + Copy,
|
||||
{
|
||||
let id = input.as_id();
|
||||
let id = input.as_id().as_u32();
|
||||
let (query_name, will_execute_event) = find_will_execute_event(db, query, input, events);
|
||||
|
||||
db.attach(|_| {
|
||||
if let Some(will_execute_event) = will_execute_event {
|
||||
panic!("Expected query {query_name}({id:?}) not to have run but it did: {will_execute_event:?}\n\n{events:#?}");
|
||||
panic!("Expected query {query_name}({id}) not to have run but it did: {will_execute_event:?}\n\n{events:#?}");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -65,7 +65,7 @@ pub fn assert_function_query_was_run<Db, Q, QDb, I, R>(
|
||||
Q: Fn(QDb, I) -> R,
|
||||
I: salsa::plumbing::AsId + std::fmt::Debug + Copy,
|
||||
{
|
||||
let id = input.as_id();
|
||||
let id = input.as_id().as_u32();
|
||||
let (query_name, will_execute_event) = find_will_execute_event(db, query, input, events);
|
||||
|
||||
db.attach(|_| {
|
||||
@@ -224,7 +224,7 @@ fn query_was_not_run() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "Expected query len(Id(0)) not to have run but it did:")]
|
||||
#[should_panic(expected = "Expected query len(0) not to have run but it did:")]
|
||||
fn query_was_not_run_fails_if_query_was_run() {
|
||||
use crate::tests::TestDb;
|
||||
use salsa::prelude::*;
|
||||
@@ -287,7 +287,7 @@ fn const_query_was_not_run_fails_if_query_was_run() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "Expected query len(Id(0)) to have run but it did not:")]
|
||||
#[should_panic(expected = "Expected query len(0) to have run but it did not:")]
|
||||
fn query_was_run_fails_if_query_was_not_run() {
|
||||
use crate::tests::TestDb;
|
||||
use salsa::prelude::*;
|
||||
|
||||
@@ -14,6 +14,7 @@ license = { workspace = true }
|
||||
ty = { workspace = true }
|
||||
ty_project = { workspace = true, features = ["schemars"] }
|
||||
ruff = { workspace = true }
|
||||
ruff_diagnostics = { workspace = true }
|
||||
ruff_formatter = { workspace = true }
|
||||
ruff_linter = { workspace = true, features = ["schemars"] }
|
||||
ruff_notebook = { workspace = true }
|
||||
|
||||
@@ -10,7 +10,7 @@ use itertools::Itertools;
|
||||
use regex::{Captures, Regex};
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use ruff_linter::FixAvailability;
|
||||
use ruff_diagnostics::FixAvailability;
|
||||
use ruff_linter::registry::{Linter, Rule, RuleNamespace};
|
||||
use ruff_options_metadata::{OptionEntry, OptionsMetadata};
|
||||
use ruff_workspace::options::Options;
|
||||
|
||||
@@ -8,7 +8,7 @@ use std::borrow::Cow;
|
||||
use std::fmt::Write;
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
use ruff_linter::FixAvailability;
|
||||
use ruff_diagnostics::FixAvailability;
|
||||
use ruff_linter::registry::{Linter, Rule, RuleNamespace};
|
||||
use ruff_linter::upstream_categories::UpstreamCategoryAndPrefix;
|
||||
use ruff_options_metadata::OptionsMetadata;
|
||||
|
||||
@@ -16,5 +16,7 @@ doctest = false
|
||||
[dependencies]
|
||||
ruff_text_size = { workspace = true }
|
||||
|
||||
anyhow = { workspace = true }
|
||||
log = { workspace = true }
|
||||
is-macro = { workspace = true }
|
||||
serde = { workspace = true, optional = true, features = [] }
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
use anyhow::Result;
|
||||
use log::debug;
|
||||
|
||||
use ruff_source_file::SourceFile;
|
||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
|
||||
use crate::registry::AsRule;
|
||||
use crate::violation::Violation;
|
||||
use crate::{Fix, codes::Rule};
|
||||
use crate::{Fix, Violation};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub struct OldDiagnostic {
|
||||
pub struct Diagnostic {
|
||||
/// The identifier of the diagnostic, used to align the diagnostic with a rule.
|
||||
pub name: &'static str,
|
||||
/// The message body to display to the user, to explain the diagnostic.
|
||||
pub body: String,
|
||||
/// The message to display to the user, to explain the suggested fix.
|
||||
@@ -17,27 +16,17 @@ pub struct OldDiagnostic {
|
||||
pub range: TextRange,
|
||||
pub fix: Option<Fix>,
|
||||
pub parent: Option<TextSize>,
|
||||
|
||||
pub(crate) rule: Rule,
|
||||
|
||||
pub(crate) file: SourceFile,
|
||||
}
|
||||
|
||||
impl OldDiagnostic {
|
||||
// TODO(brent) We temporarily allow this to avoid updating all of the call sites to add
|
||||
// references. I expect this method to go away or change significantly with the rest of the
|
||||
// diagnostic refactor, but if it still exists in this form at the end of the refactor, we
|
||||
// should just update the call sites.
|
||||
#[expect(clippy::needless_pass_by_value)]
|
||||
pub fn new<T: Violation>(kind: T, range: TextRange, file: &SourceFile) -> Self {
|
||||
impl Diagnostic {
|
||||
pub fn new<T: Violation>(kind: T, range: TextRange) -> Self {
|
||||
Self {
|
||||
name: T::rule_name(),
|
||||
body: Violation::message(&kind),
|
||||
suggestion: Violation::fix_title(&kind),
|
||||
range,
|
||||
fix: None,
|
||||
parent: None,
|
||||
rule: T::rule(),
|
||||
file: file.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +50,7 @@ impl OldDiagnostic {
|
||||
pub fn try_set_fix(&mut self, func: impl FnOnce() -> Result<Fix>) {
|
||||
match func() {
|
||||
Ok(fix) => self.fix = Some(fix),
|
||||
Err(err) => debug!("Failed to create fix for {}: {}", self.rule, err),
|
||||
Err(err) => debug!("Failed to create fix for {}: {}", self.name, err),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +61,7 @@ impl OldDiagnostic {
|
||||
match func() {
|
||||
Ok(None) => {}
|
||||
Ok(Some(fix)) => self.fix = Some(fix),
|
||||
Err(err) => debug!("Failed to create fix for {}: {}", self.rule, err),
|
||||
Err(err) => debug!("Failed to create fix for {}: {}", self.name, err),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,13 +80,7 @@ impl OldDiagnostic {
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRule for OldDiagnostic {
|
||||
fn rule(&self) -> Rule {
|
||||
self.rule
|
||||
}
|
||||
}
|
||||
|
||||
impl Ranged for OldDiagnostic {
|
||||
impl Ranged for Diagnostic {
|
||||
fn range(&self) -> TextRange {
|
||||
self.range
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
pub use diagnostic::Diagnostic;
|
||||
pub use edit::Edit;
|
||||
pub use fix::{Applicability, Fix, IsolationLevel};
|
||||
pub use source_map::{SourceMap, SourceMarker};
|
||||
pub use violation::{AlwaysFixableViolation, FixAvailability, Violation, ViolationMetadata};
|
||||
|
||||
mod diagnostic;
|
||||
mod edit;
|
||||
mod fix;
|
||||
mod source_map;
|
||||
mod violation;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use std::fmt::{Debug, Display};
|
||||
|
||||
use crate::codes::Rule;
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub enum FixAvailability {
|
||||
Sometimes,
|
||||
@@ -20,8 +18,8 @@ impl Display for FixAvailability {
|
||||
}
|
||||
|
||||
pub trait ViolationMetadata {
|
||||
/// Returns the rule for this violation
|
||||
fn rule() -> Rule;
|
||||
/// Returns the rule name of this violation
|
||||
fn rule_name() -> &'static str;
|
||||
|
||||
/// Returns an explanation of what this violation catches,
|
||||
/// why it's bad, and what users should do instead.
|
||||
@@ -44,10 +44,10 @@ impl ModuleDb {
|
||||
Program::from_settings(
|
||||
&db,
|
||||
ProgramSettings {
|
||||
python_version: Some(PythonVersionWithSource {
|
||||
python_version: PythonVersionWithSource {
|
||||
version: python_version,
|
||||
source: PythonVersionSource::default(),
|
||||
}),
|
||||
},
|
||||
python_platform: PythonPlatform::default(),
|
||||
search_paths,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ruff_linter"
|
||||
version = "0.11.12"
|
||||
version = "0.11.11"
|
||||
publish = false
|
||||
authors = { workspace = true }
|
||||
edition = { workspace = true }
|
||||
|
||||
@@ -10,10 +10,22 @@ from airflow import (
|
||||
PY312,
|
||||
)
|
||||
from airflow.api_connexion.security import requires_access
|
||||
from airflow.configuration import (
|
||||
as_dict,
|
||||
get,
|
||||
getboolean,
|
||||
getfloat,
|
||||
getint,
|
||||
has_option,
|
||||
remove_option,
|
||||
set,
|
||||
)
|
||||
from airflow.contrib.aws_athena_hook import AWSAthenaHook
|
||||
from airflow.datasets import DatasetAliasEvent
|
||||
from airflow.hooks.base_hook import BaseHook
|
||||
from airflow.operators.subdag import SubDagOperator
|
||||
from airflow.secrets.local_filesystem import LocalFilesystemBackend
|
||||
from airflow.sensors.base_sensor_operator import BaseSensorOperator
|
||||
from airflow.triggers.external_task import TaskStateTrigger
|
||||
from airflow.utils import dates
|
||||
from airflow.utils.dag_cycle_tester import test_cycle
|
||||
@@ -28,10 +40,13 @@ from airflow.utils.dates import (
|
||||
)
|
||||
from airflow.utils.db import create_session
|
||||
from airflow.utils.decorators import apply_defaults
|
||||
from airflow.utils.file import mkdirs
|
||||
from airflow.utils.file import TemporaryDirectory, mkdirs
|
||||
from airflow.utils.helpers import chain as helper_chain
|
||||
from airflow.utils.helpers import cross_downstream as helper_cross_downstream
|
||||
from airflow.utils.log import secrets_masker
|
||||
from airflow.utils.state import SHUTDOWN, terminating_states
|
||||
from airflow.utils.trigger_rule import TriggerRule
|
||||
from airflow.www.auth import has_access, has_access_dataset
|
||||
from airflow.www.auth import has_access
|
||||
from airflow.www.utils import get_sensitive_variables_fields, should_hide_value_for_key
|
||||
|
||||
# airflow root
|
||||
@@ -40,6 +55,11 @@ PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
# airflow.api_connexion.security
|
||||
requires_access
|
||||
|
||||
|
||||
# airflow.configuration
|
||||
get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
|
||||
|
||||
# airflow.contrib.*
|
||||
AWSAthenaHook()
|
||||
|
||||
@@ -48,6 +68,10 @@ AWSAthenaHook()
|
||||
DatasetAliasEvent()
|
||||
|
||||
|
||||
# airflow.hooks
|
||||
BaseHook()
|
||||
|
||||
|
||||
# airflow.operators.subdag.*
|
||||
SubDagOperator()
|
||||
|
||||
@@ -57,6 +81,10 @@ SubDagOperator()
|
||||
LocalFilesystemBackend()
|
||||
|
||||
|
||||
# airflow.sensors.base_sensor_operator
|
||||
BaseSensorOperator()
|
||||
|
||||
|
||||
# airflow.triggers.external_task
|
||||
TaskStateTrigger()
|
||||
|
||||
@@ -86,8 +114,15 @@ create_session
|
||||
apply_defaults
|
||||
|
||||
# airflow.utils.file
|
||||
TemporaryDirectory()
|
||||
mkdirs
|
||||
|
||||
# airflow.utils.helpers
|
||||
helper_chain
|
||||
helper_cross_downstream
|
||||
|
||||
# airflow.utils.log
|
||||
secrets_masker
|
||||
|
||||
# airflow.utils.state
|
||||
SHUTDOWN
|
||||
@@ -100,8 +135,37 @@ TriggerRule.NONE_FAILED_OR_SKIPPED
|
||||
|
||||
# airflow.www.auth
|
||||
has_access
|
||||
has_access_dataset
|
||||
|
||||
# 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()
|
||||
|
||||
# airflow.providers.mysql
|
||||
from airflow.providers.mysql.datasets.mysql import sanitize_uri
|
||||
|
||||
sanitize_uri
|
||||
|
||||
# airflow.providers.postgres
|
||||
from airflow.providers.postgres.datasets.postgres import sanitize_uri
|
||||
|
||||
sanitize_uri
|
||||
|
||||
# airflow.providers.trino
|
||||
from airflow.providers.trino.datasets.trino import sanitize_uri
|
||||
|
||||
sanitize_uri
|
||||
|
||||
# airflow.notifications.basenotifier
|
||||
from airflow.notifications.basenotifier import BaseNotifier
|
||||
|
||||
BaseNotifier()
|
||||
|
||||
# airflow.auth.manager
|
||||
from airflow.auth.managers.base_auth_manager import BaseAuthManager
|
||||
|
||||
BaseAuthManager()
|
||||
|
||||
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
from airflow.api_connexion.security import requires_access_dataset
|
||||
from airflow.auth.managers.models.resource_details import (
|
||||
DatasetDetails,
|
||||
|
||||
)
|
||||
from airflow.datasets.manager import (
|
||||
DatasetManager,
|
||||
@@ -11,13 +12,15 @@ from airflow.datasets.manager import (
|
||||
)
|
||||
from airflow.lineage.hook import DatasetLineageInfo
|
||||
from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
from airflow.secrets.local_filesystem import load_connections
|
||||
from airflow.secrets.local_filesystm import load_connections
|
||||
from airflow.security.permissions import RESOURCE_DATASET
|
||||
from airflow.www.auth import has_access_dataset
|
||||
|
||||
requires_access_dataset()
|
||||
|
||||
DatasetDetails()
|
||||
|
||||
|
||||
DatasetManager()
|
||||
dataset_manager()
|
||||
resolve_dataset_manager()
|
||||
@@ -31,6 +34,7 @@ load_connections()
|
||||
|
||||
RESOURCE_DATASET
|
||||
|
||||
has_access_dataset()
|
||||
|
||||
from airflow.listeners.spec.dataset import (
|
||||
on_dataset_changed,
|
||||
@@ -39,76 +43,3 @@ from airflow.listeners.spec.dataset import (
|
||||
|
||||
on_dataset_created()
|
||||
on_dataset_changed()
|
||||
|
||||
|
||||
# airflow.operators.python
|
||||
from airflow.operators.python import get_current_context
|
||||
|
||||
get_current_context()
|
||||
|
||||
# airflow.providers.mysql
|
||||
from airflow.providers.mysql.datasets.mysql import sanitize_uri
|
||||
|
||||
sanitize_uri
|
||||
|
||||
# airflow.providers.postgres
|
||||
from airflow.providers.postgres.datasets.postgres import sanitize_uri
|
||||
|
||||
sanitize_uri
|
||||
|
||||
# airflow.providers.trino
|
||||
from airflow.providers.trino.datasets.trino import sanitize_uri
|
||||
|
||||
sanitize_uri
|
||||
|
||||
# airflow.notifications.basenotifier
|
||||
from airflow.notifications.basenotifier import BaseNotifier
|
||||
|
||||
BaseNotifier()
|
||||
|
||||
# airflow.auth.manager
|
||||
from airflow.auth.managers.base_auth_manager import BaseAuthManager
|
||||
|
||||
BaseAuthManager()
|
||||
|
||||
|
||||
from airflow.configuration import (
|
||||
as_dict,
|
||||
get,
|
||||
getboolean,
|
||||
getfloat,
|
||||
getint,
|
||||
has_option,
|
||||
remove_option,
|
||||
set,
|
||||
)
|
||||
|
||||
# airflow.configuration
|
||||
get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
from airflow.hooks.base_hook import BaseHook
|
||||
|
||||
# airflow.hooks
|
||||
BaseHook()
|
||||
|
||||
from airflow.sensors.base_sensor_operator import BaseSensorOperator
|
||||
|
||||
# airflow.sensors.base_sensor_operator
|
||||
BaseSensorOperator()
|
||||
BaseHook()
|
||||
|
||||
from airflow.utils.helpers import chain as helper_chain
|
||||
from airflow.utils.helpers import cross_downstream as helper_cross_downstream
|
||||
|
||||
# airflow.utils.helpers
|
||||
helper_chain
|
||||
helper_cross_downstream
|
||||
|
||||
# airflow.utils.file
|
||||
from airflow.utils.file import TemporaryDirectory
|
||||
|
||||
TemporaryDirectory()
|
||||
|
||||
from airflow.utils.log import secrets_masker
|
||||
|
||||
# airflow.utils.log
|
||||
secrets_masker
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from airflow.providers.amazon.aws.auth_manager.avp.entities import AvpEntities
|
||||
from airflow.providers.openlineage.utils.utils import (
|
||||
DatasetInfo,
|
||||
translate_airflow_dataset,
|
||||
)
|
||||
from airflow.secrets.local_filesystem import load_connections
|
||||
from airflow.security.permissions import RESOURCE_DATASET
|
||||
|
||||
AvpEntities.DATASET
|
||||
|
||||
# airflow.providers.openlineage.utils.utils
|
||||
DatasetInfo()
|
||||
translate_airflow_dataset()
|
||||
|
||||
# airflow.secrets.local_filesystem
|
||||
load_connections()
|
||||
|
||||
# airflow.security.permissions
|
||||
RESOURCE_DATASET
|
||||
|
||||
from airflow.providers.amazon.aws.datasets.s3 import (
|
||||
convert_dataset_to_openlineage as s3_convert_dataset_to_openlineage,
|
||||
)
|
||||
from airflow.providers.amazon.aws.datasets.s3 import create_dataset as s3_create_dataset
|
||||
|
||||
s3_create_dataset()
|
||||
s3_convert_dataset_to_openlineage()
|
||||
|
||||
from airflow.providers.common.io.dataset.file import (
|
||||
convert_dataset_to_openlineage as io_convert_dataset_to_openlineage,
|
||||
)
|
||||
from airflow.providers.common.io.dataset.file import create_dataset as io_create_dataset
|
||||
|
||||
io_create_dataset()
|
||||
io_convert_dataset_to_openlineage()
|
||||
|
||||
|
||||
# # airflow.providers.google.datasets.bigquery
|
||||
from airflow.providers.google.datasets.bigquery import (
|
||||
create_dataset as bigquery_create_dataset,
|
||||
)
|
||||
|
||||
bigquery_create_dataset()
|
||||
|
||||
# airflow.providers.google.datasets.gcs
|
||||
from airflow.providers.google.datasets.gcs import (
|
||||
convert_dataset_to_openlineage as gcs_convert_dataset_to_openlineage,
|
||||
)
|
||||
from airflow.providers.google.datasets.gcs import create_dataset as gcs_create_dataset
|
||||
from airflow.providers.openlineage.utils.utils import (
|
||||
DatasetInfo,
|
||||
translate_airflow_dataset,
|
||||
)
|
||||
|
||||
AvpEntities.DATASET
|
||||
|
||||
s3_create_dataset()
|
||||
s3_convert_dataset_to_openlineage()
|
||||
|
||||
io_create_dataset()
|
||||
io_convert_dataset_to_openlineage()
|
||||
|
||||
|
||||
|
||||
# airflow.providers.google.datasets.bigquery
|
||||
bigquery_create_dataset()
|
||||
# airflow.providers.google.datasets.gcs
|
||||
gcs_create_dataset()
|
||||
gcs_convert_dataset_to_openlineage()
|
||||
# airflow.providers.openlineage.utils.utils
|
||||
DatasetInfo()
|
||||
translate_airflow_dataset()
|
||||
#
|
||||
# airflow.secrets.local_filesystem
|
||||
load_connections()
|
||||
#
|
||||
# airflow.security.permissions
|
||||
RESOURCE_DATASET
|
||||
|
||||
# airflow.timetables
|
||||
DatasetTriggeredTimetable()
|
||||
#
|
||||
# airflow.www.auth
|
||||
has_access_dataset
|
||||
|
||||
@@ -5,30 +5,35 @@ from airflow.hooks.S3_hook import (
|
||||
provide_bucket_name,
|
||||
)
|
||||
from airflow.operators.gcs_to_s3 import GCSToS3Operator
|
||||
from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
|
||||
from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
|
||||
from airflow.operators.google_api_to_s3_transfer import (
|
||||
GoogleApiToS3Operator,
|
||||
GoogleApiToS3Transfer,
|
||||
)
|
||||
from airflow.operators.redshift_to_s3_operator import (
|
||||
RedshiftToS3Operator,
|
||||
RedshiftToS3Transfer,
|
||||
)
|
||||
from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
|
||||
from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
|
||||
from airflow.operators.s3_to_redshift_operator import (
|
||||
S3ToRedshiftOperator,
|
||||
S3ToRedshiftTransfer,
|
||||
)
|
||||
from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
|
||||
S3Hook()
|
||||
provide_bucket_name()
|
||||
|
||||
GCSToS3Operator()
|
||||
|
||||
GoogleApiToS3Operator()
|
||||
RedshiftToS3Operator()
|
||||
S3FileTransformOperator()
|
||||
S3ToRedshiftOperator()
|
||||
S3KeySensor()
|
||||
|
||||
from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Transfer
|
||||
|
||||
GoogleApiToS3Transfer()
|
||||
|
||||
from airflow.operators.redshift_to_s3_operator import RedshiftToS3Transfer
|
||||
|
||||
RedshiftToS3Operator()
|
||||
RedshiftToS3Transfer()
|
||||
|
||||
from airflow.operators.s3_to_redshift_operator import S3ToRedshiftTransfer
|
||||
S3FileTransformOperator()
|
||||
|
||||
S3ToRedshiftOperator()
|
||||
S3ToRedshiftTransfer()
|
||||
|
||||
S3KeySensor()
|
||||
|
||||
@@ -4,13 +4,10 @@ from airflow.hooks.dbapi import (
|
||||
ConnectorProtocol,
|
||||
DbApiHook,
|
||||
)
|
||||
|
||||
ConnectorProtocol()
|
||||
DbApiHook()
|
||||
|
||||
from airflow.hooks.dbapi_hook import DbApiHook
|
||||
from airflow.operators.check_operator import SQLCheckOperator
|
||||
|
||||
ConnectorProtocol()
|
||||
DbApiHook()
|
||||
SQLCheckOperator()
|
||||
|
||||
|
||||
@@ -12,59 +12,55 @@ from airflow.macros.hive import (
|
||||
)
|
||||
from airflow.operators.hive_operator import HiveOperator
|
||||
from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
from airflow.operators.hive_to_mysql import (
|
||||
HiveToMySqlOperator,
|
||||
HiveToMySqlTransfer,
|
||||
)
|
||||
from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
|
||||
HIVE_QUEUE_PRIORITIES
|
||||
HiveCliHook()
|
||||
HiveMetastoreHook()
|
||||
HiveServer2Hook()
|
||||
from airflow.operators.mssql_to_hive import (
|
||||
MsSqlToHiveOperator,
|
||||
MsSqlToHiveTransfer,
|
||||
)
|
||||
from airflow.operators.mysql_to_hive import (
|
||||
MySqlToHiveOperator,
|
||||
MySqlToHiveTransfer,
|
||||
)
|
||||
from airflow.operators.s3_to_hive_operator import (
|
||||
S3ToHiveOperator,
|
||||
S3ToHiveTransfer,
|
||||
)
|
||||
from airflow.sensors.hive_partition_sensor import HivePartitionSensor
|
||||
from airflow.sensors.metastore_partition_sensor import MetastorePartitionSensor
|
||||
from airflow.sensors.named_hive_partition_sensor import NamedHivePartitionSensor
|
||||
|
||||
closest_ds_partition()
|
||||
max_partition()
|
||||
|
||||
HiveCliHook()
|
||||
HiveMetastoreHook()
|
||||
HiveServer2Hook()
|
||||
HIVE_QUEUE_PRIORITIES
|
||||
|
||||
HiveOperator()
|
||||
|
||||
HiveStatsCollectionOperator()
|
||||
|
||||
HiveToMySqlOperator()
|
||||
HiveToSambaOperator()
|
||||
|
||||
|
||||
from airflow.operators.hive_to_mysql import HiveToMySqlTransfer
|
||||
|
||||
HiveToMySqlTransfer()
|
||||
|
||||
from airflow.operators.mysql_to_hive import MySqlToHiveOperator
|
||||
|
||||
MySqlToHiveOperator()
|
||||
|
||||
from airflow.operators.mysql_to_hive import MySqlToHiveTransfer
|
||||
|
||||
MySqlToHiveTransfer()
|
||||
|
||||
from airflow.operators.mssql_to_hive import MsSqlToHiveOperator
|
||||
HiveToSambaOperator()
|
||||
|
||||
MsSqlToHiveOperator()
|
||||
|
||||
from airflow.operators.mssql_to_hive import MsSqlToHiveTransfer
|
||||
|
||||
MsSqlToHiveTransfer()
|
||||
|
||||
from airflow.operators.s3_to_hive_operator import S3ToHiveOperator
|
||||
MySqlToHiveOperator()
|
||||
MySqlToHiveTransfer()
|
||||
|
||||
S3ToHiveOperator()
|
||||
|
||||
from airflow.operators.s3_to_hive_operator import S3ToHiveTransfer
|
||||
|
||||
S3ToHiveTransfer()
|
||||
|
||||
from airflow.sensors.hive_partition_sensor import HivePartitionSensor
|
||||
|
||||
HivePartitionSensor()
|
||||
|
||||
from airflow.sensors.metastore_partition_sensor import MetastorePartitionSensor
|
||||
|
||||
MetastorePartitionSensor()
|
||||
|
||||
from airflow.sensors.named_hive_partition_sensor import NamedHivePartitionSensor
|
||||
|
||||
NamedHivePartitionSensor()
|
||||
|
||||
@@ -16,7 +16,14 @@ from airflow.kubernetes.kube_client import (
|
||||
from airflow.kubernetes.kubernetes_helper_functions import (
|
||||
add_pod_suffix,
|
||||
annotations_for_logging_task_metadata,
|
||||
annotations_to_key,
|
||||
create_pod_id,
|
||||
get_logs_task_metadata,
|
||||
rand_str,
|
||||
)
|
||||
from airflow.kubernetes.pod import (
|
||||
Port,
|
||||
Resources,
|
||||
)
|
||||
|
||||
ALL_NAMESPACES
|
||||
@@ -30,13 +37,21 @@ _enable_tcp_keepalive()
|
||||
get_kube_client()
|
||||
|
||||
add_pod_suffix()
|
||||
annotations_for_logging_task_metadata()
|
||||
create_pod_id()
|
||||
|
||||
annotations_for_logging_task_metadata()
|
||||
annotations_to_key()
|
||||
get_logs_task_metadata()
|
||||
rand_str()
|
||||
|
||||
Port()
|
||||
Resources()
|
||||
|
||||
|
||||
from airflow.kubernetes.pod_generator import (
|
||||
PodDefaults,
|
||||
PodGenerator,
|
||||
PodGeneratorDeprecated,
|
||||
add_pod_suffix,
|
||||
datetime_to_label_safe_datestring,
|
||||
extend_object_field,
|
||||
@@ -46,16 +61,18 @@ from airflow.kubernetes.pod_generator import (
|
||||
rand_str,
|
||||
)
|
||||
|
||||
PodDefaults()
|
||||
PodGenerator()
|
||||
add_pod_suffix()
|
||||
datetime_to_label_safe_datestring()
|
||||
extend_object_field()
|
||||
label_safe_datestring_to_datetime()
|
||||
make_safe_label_value()
|
||||
merge_objects()
|
||||
PodGenerator()
|
||||
PodDefaults()
|
||||
PodGeneratorDeprecated()
|
||||
add_pod_suffix()
|
||||
rand_str()
|
||||
|
||||
|
||||
from airflow.kubernetes.pod_generator_deprecated import (
|
||||
PodDefaults,
|
||||
PodGenerator,
|
||||
@@ -73,6 +90,7 @@ make_safe_label_value()
|
||||
PodLauncher()
|
||||
PodStatus()
|
||||
|
||||
|
||||
from airflow.kubernetes.pod_launcher_deprecated import (
|
||||
PodDefaults,
|
||||
PodLauncher,
|
||||
@@ -97,17 +115,3 @@ K8SModel()
|
||||
Secret()
|
||||
Volume()
|
||||
VolumeMount()
|
||||
|
||||
from airflow.kubernetes.kubernetes_helper_functions import (
|
||||
annotations_to_key,
|
||||
get_logs_task_metadata,
|
||||
rand_str,
|
||||
)
|
||||
|
||||
annotations_to_key()
|
||||
get_logs_task_metadata()
|
||||
rand_str()
|
||||
|
||||
from airflow.kubernetes.pod_generator import PodGeneratorDeprecated
|
||||
|
||||
PodGeneratorDeprecated()
|
||||
|
||||
@@ -5,6 +5,10 @@ from airflow.operators.dagrun_operator import (
|
||||
TriggerDagRunLink,
|
||||
TriggerDagRunOperator,
|
||||
)
|
||||
from airflow.operators.dummy import (
|
||||
DummyOperator,
|
||||
EmptyOperator,
|
||||
)
|
||||
from airflow.operators.latest_only_operator import LatestOnlyOperator
|
||||
from airflow.operators.python_operator import (
|
||||
BranchPythonOperator,
|
||||
@@ -15,12 +19,15 @@ from airflow.operators.python_operator import (
|
||||
from airflow.sensors.external_task_sensor import (
|
||||
ExternalTaskMarker,
|
||||
ExternalTaskSensor,
|
||||
ExternalTaskSensorLink,
|
||||
)
|
||||
|
||||
BashOperator()
|
||||
|
||||
TriggerDagRunLink()
|
||||
TriggerDagRunOperator()
|
||||
DummyOperator()
|
||||
EmptyOperator()
|
||||
|
||||
LatestOnlyOperator()
|
||||
|
||||
@@ -31,48 +38,25 @@ ShortCircuitOperator()
|
||||
|
||||
ExternalTaskMarker()
|
||||
ExternalTaskSensor()
|
||||
ExternalTaskSensorLink()
|
||||
|
||||
from airflow.operators.dummy_operator import (
|
||||
DummyOperator,
|
||||
EmptyOperator,
|
||||
)
|
||||
|
||||
DummyOperator()
|
||||
EmptyOperator()
|
||||
|
||||
from airflow.hooks.subprocess import SubprocessResult
|
||||
|
||||
SubprocessResult()
|
||||
|
||||
from airflow.hooks.subprocess import working_directory
|
||||
|
||||
working_directory()
|
||||
|
||||
from airflow.operators.datetime import target_times_as_dates
|
||||
|
||||
target_times_as_dates()
|
||||
|
||||
from airflow.operators.trigger_dagrun import TriggerDagRunLink
|
||||
|
||||
TriggerDagRunLink()
|
||||
|
||||
from airflow.sensors.external_task import ExternalTaskSensorLink
|
||||
|
||||
ExternalTaskSensorLink()
|
||||
|
||||
from airflow.sensors.time_delta import WaitSensor
|
||||
|
||||
WaitSensor()
|
||||
|
||||
from airflow.operators.dummy import DummyOperator
|
||||
|
||||
DummyOperator()
|
||||
|
||||
from airflow.operators.dummy import EmptyOperator
|
||||
|
||||
EmptyOperator()
|
||||
|
||||
from airflow.operators.dummy_operator import DummyOperator
|
||||
|
||||
DummyOperator()
|
||||
|
||||
from airflow.operators.dummy_operator import EmptyOperator
|
||||
|
||||
EmptyOperator()
|
||||
|
||||
from airflow.sensors.external_task_sensor import ExternalTaskSensorLink
|
||||
|
||||
ExternalTaskSensorLink()
|
||||
WaitSensor()
|
||||
@@ -9,12 +9,19 @@ from airflow.datasets import (
|
||||
expand_alias_to_datasets,
|
||||
)
|
||||
from airflow.datasets.metadata import Metadata
|
||||
from airflow.decorators import (
|
||||
dag,
|
||||
setup,
|
||||
task,
|
||||
task_group,
|
||||
from airflow.decorators import dag, setup, task, task_group, teardown
|
||||
from airflow.io.path import ObjectStoragePath
|
||||
from airflow.io.storage import attach
|
||||
from airflow.models import DAG as DAGFromModel
|
||||
from airflow.models import (
|
||||
Connection,
|
||||
Variable,
|
||||
)
|
||||
from airflow.models.baseoperator import chain, chain_linear, cross_downstream
|
||||
from airflow.models.baseoperatorlink import BaseOperatorLink
|
||||
from airflow.models.dag import DAG as DAGFromDag
|
||||
from airflow.timetables.datasets import DatasetOrTimeSchedule
|
||||
from airflow.utils.dag_parsing_context import get_parsing_context
|
||||
|
||||
# airflow
|
||||
DatasetFromRoot()
|
||||
@@ -32,22 +39,9 @@ dag()
|
||||
task()
|
||||
task_group()
|
||||
setup()
|
||||
from airflow.decorators import teardown
|
||||
from airflow.io.path import ObjectStoragePath
|
||||
from airflow.io.storage import attach
|
||||
from airflow.models import DAG as DAGFromModel
|
||||
from airflow.models import (
|
||||
Connection,
|
||||
Variable,
|
||||
)
|
||||
from airflow.models.baseoperator import chain, chain_linear, cross_downstream
|
||||
from airflow.models.baseoperatorlink import BaseOperatorLink
|
||||
from airflow.models.dag import DAG as DAGFromDag
|
||||
|
||||
# airflow.decorators
|
||||
teardown()
|
||||
|
||||
# # airflow.io
|
||||
# airflow.io
|
||||
ObjectStoragePath()
|
||||
attach()
|
||||
|
||||
@@ -66,9 +60,6 @@ BaseOperatorLink()
|
||||
|
||||
# airflow.models.dag
|
||||
DAGFromDag()
|
||||
from airflow.timetables.datasets import DatasetOrTimeSchedule
|
||||
from airflow.utils.dag_parsing_context import get_parsing_context
|
||||
|
||||
# airflow.timetables.datasets
|
||||
DatasetOrTimeSchedule()
|
||||
|
||||
|
||||
@@ -7,71 +7,49 @@ from airflow.operators.bash import BashOperator
|
||||
from airflow.operators.datetime import BranchDateTimeOperator
|
||||
from airflow.operators.empty import EmptyOperator
|
||||
from airflow.operators.latest_only import LatestOnlyOperator
|
||||
from airflow.operators.trigger_dagrun import TriggerDagRunOperator
|
||||
from airflow.operators.weekday import BranchDayOfWeekOperator
|
||||
from airflow.sensors.date_time import DateTimeSensor
|
||||
|
||||
FSHook()
|
||||
PackageIndexHook()
|
||||
SubprocessHook()
|
||||
|
||||
BashOperator()
|
||||
BranchDateTimeOperator()
|
||||
TriggerDagRunOperator()
|
||||
EmptyOperator()
|
||||
|
||||
LatestOnlyOperator()
|
||||
BranchDayOfWeekOperator()
|
||||
DateTimeSensor()
|
||||
|
||||
from airflow.operators.python import (
|
||||
BranchPythonOperator,
|
||||
PythonOperator,
|
||||
PythonVirtualenvOperator,
|
||||
ShortCircuitOperator,
|
||||
)
|
||||
from airflow.sensors.date_time import DateTimeSensorAsync
|
||||
from airflow.operators.trigger_dagrun import TriggerDagRunOperator
|
||||
from airflow.operators.weekday import BranchDayOfWeekOperator
|
||||
from airflow.sensors.date_time import DateTimeSensor, DateTimeSensorAsync
|
||||
from airflow.sensors.external_task import (
|
||||
ExternalTaskMarker,
|
||||
ExternalTaskSensor,
|
||||
)
|
||||
from airflow.sensors.time_sensor import (
|
||||
TimeSensor,
|
||||
TimeSensorAsync,
|
||||
|
||||
)
|
||||
from airflow.sensors.filesystem import FileSensor
|
||||
|
||||
BranchPythonOperator()
|
||||
PythonOperator()
|
||||
PythonVirtualenvOperator()
|
||||
ShortCircuitOperator()
|
||||
DateTimeSensorAsync()
|
||||
ExternalTaskMarker()
|
||||
ExternalTaskSensor()
|
||||
FileSensor()
|
||||
TimeSensor()
|
||||
TimeSensorAsync()
|
||||
|
||||
from airflow.sensors.time_delta import (
|
||||
TimeDeltaSensor,
|
||||
TimeDeltaSensorAsync,
|
||||
)
|
||||
from airflow.sensors.time_delta import TimeDeltaSensor, TimeDeltaSensorAsync
|
||||
from airflow.sensors.time_sensor import TimeSensor, TimeSensorAsync
|
||||
from airflow.sensors.weekday import DayOfWeekSensor
|
||||
from airflow.triggers.external_task import (
|
||||
DagStateTrigger,
|
||||
WorkflowTrigger,
|
||||
)
|
||||
from airflow.triggers.external_task import DagStateTrigger, WorkflowTrigger
|
||||
from airflow.triggers.file import FileTrigger
|
||||
from airflow.triggers.temporal import (
|
||||
DateTimeTrigger,
|
||||
TimeDeltaTrigger,
|
||||
)
|
||||
from airflow.triggers.temporal import DateTimeTrigger, TimeDeltaTrigger
|
||||
|
||||
TimeDeltaSensor()
|
||||
TimeDeltaSensorAsync()
|
||||
FSHook()
|
||||
PackageIndexHook()
|
||||
SubprocessHook()
|
||||
BashOperator()
|
||||
BranchDateTimeOperator()
|
||||
TriggerDagRunOperator()
|
||||
EmptyOperator()
|
||||
LatestOnlyOperator()
|
||||
(
|
||||
BranchPythonOperator(),
|
||||
PythonOperator(),
|
||||
PythonVirtualenvOperator(),
|
||||
ShortCircuitOperator(),
|
||||
)
|
||||
BranchDayOfWeekOperator()
|
||||
DateTimeSensor(), DateTimeSensorAsync()
|
||||
ExternalTaskMarker(), ExternalTaskSensor()
|
||||
FileSensor()
|
||||
TimeSensor(), TimeSensorAsync()
|
||||
TimeDeltaSensor(), TimeDeltaSensorAsync()
|
||||
DayOfWeekSensor()
|
||||
DagStateTrigger()
|
||||
WorkflowTrigger()
|
||||
DagStateTrigger(), WorkflowTrigger()
|
||||
FileTrigger()
|
||||
DateTimeTrigger()
|
||||
TimeDeltaTrigger()
|
||||
DateTimeTrigger(), TimeDeltaTrigger()
|
||||
|
||||
@@ -178,38 +178,3 @@ async def unknown_1(other: str = Depends(unknown_unresolved)): ...
|
||||
async def unknown_2(other: str = Depends(unknown_not_function)): ...
|
||||
@app.get("/things/{thing_id}")
|
||||
async def unknown_3(other: str = Depends(unknown_imported)): ...
|
||||
|
||||
|
||||
# Class dependencies
|
||||
from pydantic import BaseModel
|
||||
from dataclasses import dataclass
|
||||
|
||||
class PydanticParams(BaseModel):
|
||||
my_id: int
|
||||
|
||||
|
||||
class InitParams:
|
||||
def __init__(self, my_id: int):
|
||||
self.my_id = my_id
|
||||
|
||||
|
||||
# Errors
|
||||
@app.get("/{id}")
|
||||
async def get_id_pydantic_full(
|
||||
params: Annotated[PydanticParams, Depends(PydanticParams)],
|
||||
): ...
|
||||
@app.get("/{id}")
|
||||
async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()]): ...
|
||||
@app.get("/{id}")
|
||||
async def get_id_init_not_annotated(params = Depends(InitParams)): ...
|
||||
|
||||
|
||||
# No errors
|
||||
@app.get("/{my_id}")
|
||||
async def get_id_pydantic_full(
|
||||
params: Annotated[PydanticParams, Depends(PydanticParams)],
|
||||
): ...
|
||||
@app.get("/{my_id}")
|
||||
async def get_id_pydantic_short(params: Annotated[PydanticParams, Depends()]): ...
|
||||
@app.get("/{my_id}")
|
||||
async def get_id_init_not_annotated(params = Depends(InitParams)): ...
|
||||
|
||||
@@ -22,8 +22,3 @@ def my_func():
|
||||
|
||||
# Implicit string concatenation
|
||||
"0.0.0.0" f"0.0.0.0{expr}0.0.0.0"
|
||||
|
||||
# t-strings - all ok
|
||||
t"0.0.0.0"
|
||||
"0.0.0.0" t"0.0.0.0{expr}0.0.0.0"
|
||||
"0.0.0.0" f"0.0.0.0{expr}0.0.0.0" t"0.0.0.0{expr}0.0.0.0"
|
||||
|
||||
@@ -40,7 +40,3 @@ with tempfile.TemporaryDirectory(dir="/dev/shm") as d:
|
||||
|
||||
with TemporaryDirectory(dir="/tmp") as d:
|
||||
pass
|
||||
|
||||
# ok (runtime error from t-string)
|
||||
with open(t"/foo/bar", "w") as f:
|
||||
f.write("def")
|
||||
|
||||
@@ -169,13 +169,3 @@ query60 = f"""
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/17967
|
||||
query61 = f"SELECT * FROM table" # skip expressionless f-strings
|
||||
|
||||
# t-strings
|
||||
query62 = t"SELECT * FROM table"
|
||||
query63 = t"""
|
||||
SELECT *,
|
||||
foo
|
||||
FROM ({user_input}) raw
|
||||
"""
|
||||
query64 = f"update {t"{table}"} set var = {t"{var}"}"
|
||||
query65 = t"update {f"{table}"} set var = {f"{var}"}"
|
||||
|
||||
@@ -67,6 +67,3 @@ getattr(self.
|
||||
|
||||
import builtins
|
||||
builtins.getattr(foo, "bar")
|
||||
|
||||
# Regression test for: https://github.com/astral-sh/ruff/issues/18353
|
||||
setattr(foo, "__debug__", 0)
|
||||
|
||||
@@ -91,99 +91,3 @@ _ = "\8""0" # fix should be "\80"
|
||||
_ = "\12""8" # fix should be "\128"
|
||||
_ = "\12""foo" # fix should be "\12foo"
|
||||
_ = "\12" "" # fix should be "\12"
|
||||
|
||||
|
||||
# Mixed literal + non-literal scenarios
|
||||
_ = (
|
||||
"start" +
|
||||
variable +
|
||||
"end"
|
||||
)
|
||||
|
||||
_ = (
|
||||
f"format" +
|
||||
func_call() +
|
||||
"literal"
|
||||
)
|
||||
|
||||
_ = (
|
||||
rf"raw_f{x}" +
|
||||
r"raw_normal"
|
||||
)
|
||||
|
||||
|
||||
# Different prefix combinations
|
||||
_ = (
|
||||
u"unicode" +
|
||||
r"raw"
|
||||
)
|
||||
|
||||
_ = (
|
||||
rb"raw_bytes" +
|
||||
b"normal_bytes"
|
||||
)
|
||||
|
||||
_ = (
|
||||
b"bytes" +
|
||||
b"with_bytes"
|
||||
)
|
||||
|
||||
# Repeated concatenation
|
||||
|
||||
_ = ("a" +
|
||||
"b" +
|
||||
"c" +
|
||||
"d" + "e"
|
||||
)
|
||||
|
||||
_ = ("a"
|
||||
+ "b"
|
||||
+ "c"
|
||||
+ "d"
|
||||
+ "e"
|
||||
)
|
||||
|
||||
_ = (
|
||||
"start" +
|
||||
variable + # comment
|
||||
"end"
|
||||
)
|
||||
|
||||
_ = (
|
||||
"start" +
|
||||
variable
|
||||
# leading comment
|
||||
+ "end"
|
||||
)
|
||||
|
||||
_ = (
|
||||
"first"
|
||||
+ "second" # extra spaces around +
|
||||
)
|
||||
|
||||
_ = (
|
||||
"first" + # trailing spaces before +
|
||||
"second"
|
||||
)
|
||||
|
||||
_ = ((
|
||||
"deep" +
|
||||
"nesting"
|
||||
))
|
||||
|
||||
_ = (
|
||||
"contains + plus" +
|
||||
"another string"
|
||||
)
|
||||
|
||||
_ = (
|
||||
"start"
|
||||
# leading comment
|
||||
+ "end"
|
||||
)
|
||||
|
||||
_ = (
|
||||
"start" +
|
||||
# leading comment
|
||||
"end"
|
||||
)
|
||||
|
||||
@@ -72,5 +72,3 @@ def not_warnings_dot_deprecated(
|
||||
|
||||
@not_warnings_dot_deprecated("Not warnings.deprecated, so this one *should* lead to PYI053 in a stub!")
|
||||
def not_a_deprecated_function() -> None: ...
|
||||
|
||||
baz: str = t"51 character stringgggggggggggggggggggggggggggggggg"
|
||||
|
||||
@@ -80,7 +80,3 @@ x: TypeAlias = Literal["fooooooooooooooooooooooooooooooooooooooooooooooooooooooo
|
||||
|
||||
# Ok
|
||||
y: TypeAlias = Annotated[int, "metadataaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]
|
||||
|
||||
ttoo: str = t"50 character stringggggggggggggggggggggggggggggggg" # OK
|
||||
|
||||
tbar: str = t"51 character stringgggggggggggggggggggggggggggggggg" # Error: PYI053
|
||||
|
||||
@@ -39,27 +39,3 @@ f'\'normal\' {f'nested'} normal' # Q003
|
||||
f'\'normal\' {f'nested'} "double quotes"'
|
||||
f'\'normal\' {f'\'nested\' {'other'} normal'} "double quotes"' # Q003
|
||||
f'\'normal\' {f'\'nested\' {'other'} "double quotes"'} normal' # Q00l
|
||||
|
||||
|
||||
|
||||
# Same as above, but with t-strings
|
||||
t'This is a \'string\'' # Q003
|
||||
t'This is \\ a \\\'string\'' # Q003
|
||||
t'"This" is a \'string\''
|
||||
f"This is a 'string'"
|
||||
f"\"This\" is a 'string'"
|
||||
fr'This is a \'string\''
|
||||
fR'This is a \'string\''
|
||||
foo = (
|
||||
t'This is a'
|
||||
t'\'string\'' # Q003
|
||||
)
|
||||
t'\'foo\' {'nested'}' # Q003
|
||||
t'\'foo\' {t'nested'}' # Q003
|
||||
t'\'foo\' {t'\'nested\''} \'\'' # Q003
|
||||
|
||||
t'normal {t'nested'} normal'
|
||||
t'\'normal\' {t'nested'} normal' # Q003
|
||||
t'\'normal\' {t'nested'} "double quotes"'
|
||||
t'\'normal\' {t'\'nested\' {'other'} normal'} "double quotes"' # Q003
|
||||
t'\'normal\' {t'\'nested\' {'other'} "double quotes"'} normal' # Q00l
|
||||
|
||||
@@ -37,25 +37,3 @@ f"\"normal\" {f"nested"} normal" # Q003
|
||||
f"\"normal\" {f"nested"} 'single quotes'"
|
||||
f"\"normal\" {f"\"nested\" {"other"} normal"} 'single quotes'" # Q003
|
||||
f"\"normal\" {f"\"nested\" {"other"} 'single quotes'"} normal" # Q003
|
||||
|
||||
|
||||
# Same as above, but with t-strings
|
||||
t"This is a \"string\""
|
||||
t"'This' is a \"string\""
|
||||
f'This is a "string"'
|
||||
f'\'This\' is a "string"'
|
||||
fr"This is a \"string\""
|
||||
fR"This is a \"string\""
|
||||
foo = (
|
||||
t"This is a"
|
||||
t"\"string\""
|
||||
)
|
||||
t"\"foo\" {"foo"}" # Q003
|
||||
t"\"foo\" {t"foo"}" # Q003
|
||||
t"\"foo\" {t"\"foo\""} \"\"" # Q003
|
||||
|
||||
t"normal {t"nested"} normal"
|
||||
t"\"normal\" {t"nested"} normal" # Q003
|
||||
t"\"normal\" {t"nested"} 'single quotes'"
|
||||
t"\"normal\" {t"\"nested\" {"other"} normal"} 'single quotes'" # Q003
|
||||
t"\"normal\" {t"\"nested\" {"other"} 'single quotes'"} normal" # Q003
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
os.symlink("usr/bin/python", "tmp/python")
|
||||
os.symlink(b"usr/bin/python", b"tmp/python")
|
||||
Path("tmp/python").symlink_to("usr/bin/python") # Ok
|
||||
|
||||
os.symlink("usr/bin/python", "tmp/python", target_is_directory=True)
|
||||
os.symlink(b"usr/bin/python", b"tmp/python", target_is_directory=True)
|
||||
Path("tmp/python").symlink_to("usr/bin/python", target_is_directory=True) # Ok
|
||||
|
||||
fd = os.open(".", os.O_RDONLY)
|
||||
os.symlink("source.txt", "link.txt", dir_fd=fd) # Ok: dir_fd is not supported by pathlib
|
||||
os.close(fd)
|
||||
@@ -1,4 +1,4 @@
|
||||
# Same as `W605_0.py` but using f-strings and t-strings instead.
|
||||
# Same as `W605_0.py` but using f-strings instead.
|
||||
|
||||
#: W605:1:10
|
||||
regex = f'\.png$'
|
||||
@@ -66,72 +66,3 @@ s = f"TOTAL: {total}\nOK: {ok}\INCOMPLETE: {incomplete}\n"
|
||||
|
||||
# Debug text (should trigger)
|
||||
t = f"{'\InHere'=}"
|
||||
|
||||
|
||||
|
||||
#: W605:1:10
|
||||
regex = t'\.png$'
|
||||
|
||||
#: W605:2:1
|
||||
regex = t'''
|
||||
\.png$
|
||||
'''
|
||||
|
||||
#: W605:2:6
|
||||
f(
|
||||
t'\_'
|
||||
)
|
||||
|
||||
#: W605:4:6
|
||||
t"""
|
||||
multi-line
|
||||
literal
|
||||
with \_ somewhere
|
||||
in the middle
|
||||
"""
|
||||
|
||||
#: W605:1:38
|
||||
value = t'new line\nand invalid escape \_ here'
|
||||
|
||||
|
||||
#: Okay
|
||||
regex = fr'\.png$'
|
||||
regex = t'\\.png$'
|
||||
regex = fr'''
|
||||
\.png$
|
||||
'''
|
||||
regex = fr'''
|
||||
\\.png$
|
||||
'''
|
||||
s = t'\\'
|
||||
regex = t'\w' # noqa
|
||||
regex = t'''
|
||||
\w
|
||||
''' # noqa
|
||||
|
||||
regex = t'\\\_'
|
||||
value = t'\{{1}}'
|
||||
value = t'\{1}'
|
||||
value = t'{1:\}'
|
||||
value = t"{t"\{1}"}"
|
||||
value = rt"{t"\{1}"}"
|
||||
|
||||
# Okay
|
||||
value = rt'\{{1}}'
|
||||
value = rt'\{1}'
|
||||
value = rt'{1:\}'
|
||||
value = t"{rt"\{1}"}"
|
||||
|
||||
# Regression tests for https://github.com/astral-sh/ruff/issues/10434
|
||||
t"{{}}+-\d"
|
||||
t"\n{{}}+-\d+"
|
||||
t"\n{{}}<7D>+-\d+"
|
||||
|
||||
# See https://github.com/astral-sh/ruff/issues/11491
|
||||
total = 10
|
||||
ok = 7
|
||||
incomplete = 3
|
||||
s = t"TOTAL: {total}\nOK: {ok}\INCOMPLETE: {incomplete}\n"
|
||||
|
||||
# Debug text (should trigger)
|
||||
t = t"{'\InHere'=}"
|
||||
|
||||
@@ -1,184 +0,0 @@
|
||||
SEQ = "1,2,3"
|
||||
|
||||
class Foo(str):
|
||||
class_str = "1,2,3"
|
||||
|
||||
def split(self, sep=None, maxsplit=-1) -> list[str]:
|
||||
return super().split(sep, maxsplit)
|
||||
|
||||
class Bar():
|
||||
split = "1,2,3"
|
||||
|
||||
# Errors
|
||||
## Test split called directly on string literal
|
||||
"1,2,3".split(",")[0] # [missing-maxsplit-arg]
|
||||
"1,2,3".split(",")[-1] # [missing-maxsplit-arg]
|
||||
"1,2,3".rsplit(",")[0] # [missing-maxsplit-arg]
|
||||
"1,2,3".rsplit(",")[-1] # [missing-maxsplit-arg]
|
||||
|
||||
## Test split called on string variable
|
||||
SEQ.split(",")[0] # [missing-maxsplit-arg]
|
||||
SEQ.split(",")[-1] # [missing-maxsplit-arg]
|
||||
SEQ.rsplit(",")[0] # [missing-maxsplit-arg]
|
||||
SEQ.rsplit(",")[-1] # [missing-maxsplit-arg]
|
||||
|
||||
## Test split called on class attribute
|
||||
Foo.class_str.split(",")[0] # [missing-maxsplit-arg]
|
||||
Foo.class_str.split(",")[-1] # [missing-maxsplit-arg]
|
||||
Foo.class_str.rsplit(",")[0] # [missing-maxsplit-arg]
|
||||
Foo.class_str.rsplit(",")[-1] # [missing-maxsplit-arg]
|
||||
|
||||
## Test split called on sliced string
|
||||
"1,2,3"[::-1].split(",")[0] # [missing-maxsplit-arg]
|
||||
"1,2,3"[::-1][::-1].split(",")[0] # [missing-maxsplit-arg]
|
||||
SEQ[:3].split(",")[0] # [missing-maxsplit-arg]
|
||||
Foo.class_str[1:3].split(",")[-1] # [missing-maxsplit-arg]
|
||||
"1,2,3"[::-1].rsplit(",")[0] # [missing-maxsplit-arg]
|
||||
SEQ[:3].rsplit(",")[0] # [missing-maxsplit-arg]
|
||||
Foo.class_str[1:3].rsplit(",")[-1] # [missing-maxsplit-arg]
|
||||
|
||||
## Test sep given as named argument
|
||||
"1,2,3".split(sep=",")[0] # [missing-maxsplit-arg]
|
||||
"1,2,3".split(sep=",")[-1] # [missing-maxsplit-arg]
|
||||
"1,2,3".rsplit(sep=",")[0] # [missing-maxsplit-arg]
|
||||
"1,2,3".rsplit(sep=",")[-1] # [missing-maxsplit-arg]
|
||||
|
||||
## Special cases
|
||||
"1,2,3".split("\n")[0] # [missing-maxsplit-arg]
|
||||
"1,2,3".split("split")[-1] # [missing-maxsplit-arg]
|
||||
"1,2,3".rsplit("rsplit")[0] # [missing-maxsplit-arg]
|
||||
|
||||
## Test class attribute named split
|
||||
Bar.split.split(",")[0] # [missing-maxsplit-arg]
|
||||
Bar.split.split(",")[-1] # [missing-maxsplit-arg]
|
||||
Bar.split.rsplit(",")[0] # [missing-maxsplit-arg]
|
||||
Bar.split.rsplit(",")[-1] # [missing-maxsplit-arg]
|
||||
|
||||
## Test unpacked dict literal kwargs
|
||||
"1,2,3".split(**{"sep": ","})[0] # [missing-maxsplit-arg]
|
||||
|
||||
|
||||
# OK
|
||||
## Test not accessing the first or last element
|
||||
### Test split called directly on string literal
|
||||
"1,2,3".split(",")[1]
|
||||
"1,2,3".split(",")[-2]
|
||||
"1,2,3".rsplit(",")[1]
|
||||
"1,2,3".rsplit(",")[-2]
|
||||
|
||||
### Test split called on string variable
|
||||
SEQ.split(",")[1]
|
||||
SEQ.split(",")[-2]
|
||||
SEQ.rsplit(",")[1]
|
||||
SEQ.rsplit(",")[-2]
|
||||
|
||||
### Test split called on class attribute
|
||||
Foo.class_str.split(",")[1]
|
||||
Foo.class_str.split(",")[-2]
|
||||
Foo.class_str.rsplit(",")[1]
|
||||
Foo.class_str.rsplit(",")[-2]
|
||||
|
||||
### Test split called on sliced string
|
||||
"1,2,3"[::-1].split(",")[1]
|
||||
SEQ[:3].split(",")[1]
|
||||
Foo.class_str[1:3].split(",")[-2]
|
||||
"1,2,3"[::-1].rsplit(",")[1]
|
||||
SEQ[:3].rsplit(",")[1]
|
||||
Foo.class_str[1:3].rsplit(",")[-2]
|
||||
|
||||
### Test sep given as named argument
|
||||
"1,2,3".split(sep=",")[1]
|
||||
"1,2,3".split(sep=",")[-2]
|
||||
"1,2,3".rsplit(sep=",")[1]
|
||||
"1,2,3".rsplit(sep=",")[-2]
|
||||
|
||||
## Test varying maxsplit argument
|
||||
### str.split() tests
|
||||
"1,2,3".split(sep=",", maxsplit=1)[-1]
|
||||
"1,2,3".split(sep=",", maxsplit=1)[0]
|
||||
"1,2,3".split(sep=",", maxsplit=2)[-1]
|
||||
"1,2,3".split(sep=",", maxsplit=2)[0]
|
||||
"1,2,3".split(sep=",", maxsplit=2)[1]
|
||||
|
||||
### str.rsplit() tests
|
||||
"1,2,3".rsplit(sep=",", maxsplit=1)[-1]
|
||||
"1,2,3".rsplit(sep=",", maxsplit=1)[0]
|
||||
"1,2,3".rsplit(sep=",", maxsplit=2)[-1]
|
||||
"1,2,3".rsplit(sep=",", maxsplit=2)[0]
|
||||
"1,2,3".rsplit(sep=",", maxsplit=2)[1]
|
||||
|
||||
## Test user-defined split
|
||||
Foo("1,2,3").split(",")[0]
|
||||
Foo("1,2,3").split(",")[-1]
|
||||
Foo("1,2,3").rsplit(",")[0]
|
||||
Foo("1,2,3").rsplit(",")[-1]
|
||||
|
||||
## Test split called on sliced list
|
||||
["1", "2", "3"][::-1].split(",")[0]
|
||||
|
||||
## Test class attribute named split
|
||||
Bar.split[0]
|
||||
Bar.split[-1]
|
||||
Bar.split[0]
|
||||
Bar.split[-1]
|
||||
|
||||
## Test unpacked dict literal kwargs
|
||||
"1,2,3".split(",", **{"maxsplit": 1})[0]
|
||||
"1,2,3".split(**{"sep": ",", "maxsplit": 1})[0]
|
||||
|
||||
|
||||
# TODO
|
||||
|
||||
## Test variable split result index
|
||||
## TODO: These require the ability to resolve a variable name to a value
|
||||
# Errors
|
||||
result_index = 0
|
||||
"1,2,3".split(",")[result_index] # TODO: [missing-maxsplit-arg]
|
||||
result_index = -1
|
||||
"1,2,3".split(",")[result_index] # TODO: [missing-maxsplit-arg]
|
||||
# OK
|
||||
result_index = 1
|
||||
"1,2,3".split(",")[result_index]
|
||||
result_index = -2
|
||||
"1,2,3".split(",")[result_index]
|
||||
|
||||
|
||||
## Test split result index modified in loop
|
||||
## TODO: These require the ability to recognize being in a loop where:
|
||||
## - the result of split called on a string is indexed by a variable
|
||||
## - the variable index above is modified
|
||||
# OK
|
||||
result_index = 0
|
||||
for j in range(3):
|
||||
print(SEQ.split(",")[result_index])
|
||||
result_index = result_index + 1
|
||||
|
||||
|
||||
## Test accessor
|
||||
## TODO: These require the ability to get the return type of a method
|
||||
## (possibly via `typing::is_string`)
|
||||
class Baz():
|
||||
def __init__(self):
|
||||
self.my_str = "1,2,3"
|
||||
|
||||
def get_string(self) -> str:
|
||||
return self.my_str
|
||||
|
||||
# Errors
|
||||
Baz().get_string().split(",")[0] # TODO: [missing-maxsplit-arg]
|
||||
Baz().get_string().split(",")[-1] # TODO: [missing-maxsplit-arg]
|
||||
# OK
|
||||
Baz().get_string().split(",")[1]
|
||||
Baz().get_string().split(",")[-2]
|
||||
|
||||
|
||||
## Test unpacked dict instance kwargs
|
||||
## TODO: These require the ability to resolve a dict variable name to a value
|
||||
# Errors
|
||||
kwargs_without_maxsplit = {"seq": ","}
|
||||
"1,2,3".split(**kwargs_without_maxsplit)[0] # TODO: [missing-maxsplit-arg]
|
||||
# OK
|
||||
kwargs_with_maxsplit = {"maxsplit": 1}
|
||||
"1,2,3".split(",", **kwargs_with_maxsplit)[0] # TODO: false positive
|
||||
kwargs_with_maxsplit = {"sep": ",", "maxsplit": 1}
|
||||
"1,2,3".split(**kwargs_with_maxsplit)[0] # TODO: false positive
|
||||
@@ -1,84 +0,0 @@
|
||||
class A:
|
||||
...
|
||||
|
||||
|
||||
class A(metaclass=type):
|
||||
...
|
||||
|
||||
|
||||
class A(
|
||||
metaclass=type
|
||||
):
|
||||
...
|
||||
|
||||
|
||||
class A(
|
||||
metaclass=type
|
||||
#
|
||||
):
|
||||
...
|
||||
|
||||
|
||||
class A(
|
||||
#
|
||||
metaclass=type
|
||||
):
|
||||
...
|
||||
|
||||
|
||||
class A(
|
||||
metaclass=type,
|
||||
#
|
||||
):
|
||||
...
|
||||
|
||||
|
||||
class A(
|
||||
#
|
||||
metaclass=type,
|
||||
#
|
||||
):
|
||||
...
|
||||
|
||||
|
||||
class B(A, metaclass=type):
|
||||
...
|
||||
|
||||
|
||||
class B(
|
||||
A,
|
||||
metaclass=type,
|
||||
):
|
||||
...
|
||||
|
||||
|
||||
class B(
|
||||
A,
|
||||
# comment
|
||||
metaclass=type,
|
||||
):
|
||||
...
|
||||
|
||||
|
||||
def foo():
|
||||
class A(metaclass=type):
|
||||
...
|
||||
|
||||
|
||||
class A(
|
||||
metaclass=type # comment
|
||||
,
|
||||
):
|
||||
...
|
||||
|
||||
|
||||
type = str
|
||||
|
||||
class Foo(metaclass=type):
|
||||
...
|
||||
|
||||
|
||||
import builtins
|
||||
|
||||
class A(metaclass=builtins.type):
|
||||
...
|
||||
@@ -43,6 +43,7 @@ def func():
|
||||
|
||||
import builtins
|
||||
|
||||
|
||||
with builtins.open("FURB129.py") as f:
|
||||
for line in f.readlines():
|
||||
pass
|
||||
@@ -50,6 +51,7 @@ with builtins.open("FURB129.py") as f:
|
||||
|
||||
from builtins import open as o
|
||||
|
||||
|
||||
with o("FURB129.py") as f:
|
||||
for line in f.readlines():
|
||||
pass
|
||||
@@ -87,18 +89,3 @@ with open("FURB129.py") as f:
|
||||
pass
|
||||
for _not_line in f.readline():
|
||||
pass
|
||||
|
||||
# https://github.com/astral-sh/ruff/issues/18231
|
||||
with open("furb129.py") as f:
|
||||
for line in (f).readlines():
|
||||
pass
|
||||
|
||||
with open("furb129.py") as f:
|
||||
[line for line in (f).readlines()]
|
||||
|
||||
|
||||
with open("furb129.py") as f:
|
||||
for line in (((f))).readlines():
|
||||
pass
|
||||
for line in(f).readlines():
|
||||
pass
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
# Errors.
|
||||
|
||||
if 1 in set([1]):
|
||||
print("Single-element set")
|
||||
|
||||
if 1 in set((1,)):
|
||||
print("Single-element set")
|
||||
|
||||
if 1 in set({1}):
|
||||
print("Single-element set")
|
||||
|
||||
if 1 in frozenset([1]):
|
||||
print("Single-element set")
|
||||
|
||||
if 1 in frozenset((1,)):
|
||||
print("Single-element set")
|
||||
|
||||
if 1 in frozenset({1}):
|
||||
print("Single-element set")
|
||||
|
||||
if 1 in set(set([1])):
|
||||
print('Recursive solution')
|
||||
|
||||
|
||||
|
||||
# Non-errors.
|
||||
|
||||
if 1 in set((1, 2)):
|
||||
pass
|
||||
|
||||
if 1 in set([1, 2]):
|
||||
pass
|
||||
|
||||
if 1 in set({1, 2}):
|
||||
pass
|
||||
|
||||
if 1 in frozenset((1, 2)):
|
||||
pass
|
||||
|
||||
if 1 in frozenset([1, 2]):
|
||||
pass
|
||||
|
||||
if 1 in frozenset({1, 2}):
|
||||
pass
|
||||
|
||||
if 1 in set(1,):
|
||||
pass
|
||||
|
||||
if 1 in set(1,2):
|
||||
pass
|
||||
|
||||
if 1 in set((x for x in range(2))):
|
||||
pass
|
||||
@@ -1,6 +1,6 @@
|
||||
use ruff_diagnostics::{Diagnostic, Fix};
|
||||
use ruff_text_size::Ranged;
|
||||
|
||||
use crate::Fix;
|
||||
use crate::checkers::ast::Checker;
|
||||
use crate::codes::Rule;
|
||||
use crate::rules::{
|
||||
@@ -38,64 +38,92 @@ pub(crate) fn bindings(checker: &Checker) {
|
||||
.dummy_variable_rgx
|
||||
.is_match(binding.name(checker.source()))
|
||||
{
|
||||
checker
|
||||
.report_diagnostic(
|
||||
pyflakes::rules::UnusedVariable {
|
||||
name: binding.name(checker.source()).to_string(),
|
||||
},
|
||||
binding.range(),
|
||||
)
|
||||
.try_set_fix(|| {
|
||||
pyflakes::fixes::remove_exception_handler_assignment(
|
||||
binding,
|
||||
checker.locator,
|
||||
)
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
pyflakes::rules::UnusedVariable {
|
||||
name: binding.name(checker.source()).to_string(),
|
||||
},
|
||||
binding.range(),
|
||||
);
|
||||
diagnostic.try_set_fix(|| {
|
||||
pyflakes::fixes::remove_exception_handler_assignment(binding, checker.locator)
|
||||
.map(Fix::safe_edit)
|
||||
});
|
||||
});
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::InvalidAllFormat) {
|
||||
pylint::rules::invalid_all_format(checker, binding);
|
||||
if let Some(diagnostic) = pylint::rules::invalid_all_format(binding) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::InvalidAllObject) {
|
||||
pylint::rules::invalid_all_object(checker, binding);
|
||||
if let Some(diagnostic) = pylint::rules::invalid_all_object(binding) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::NonAsciiName) {
|
||||
pylint::rules::non_ascii_name(checker, binding);
|
||||
if let Some(diagnostic) = pylint::rules::non_ascii_name(binding, checker.locator) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::UnconventionalImportAlias) {
|
||||
flake8_import_conventions::rules::unconventional_import_alias(
|
||||
if let Some(diagnostic) = flake8_import_conventions::rules::unconventional_import_alias(
|
||||
checker,
|
||||
binding,
|
||||
&checker.settings.flake8_import_conventions.aliases,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::UnaliasedCollectionsAbcSetImport) {
|
||||
flake8_pyi::rules::unaliased_collections_abc_set_import(checker, binding);
|
||||
if let Some(diagnostic) =
|
||||
flake8_pyi::rules::unaliased_collections_abc_set_import(checker, binding)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if !checker.source_type.is_stub() && checker.enabled(Rule::UnquotedTypeAlias) {
|
||||
flake8_type_checking::rules::unquoted_type_alias(checker, binding);
|
||||
}
|
||||
if checker.enabled(Rule::UnsortedDunderSlots) {
|
||||
ruff::rules::sort_dunder_slots(checker, binding);
|
||||
if let Some(diagnostic) = ruff::rules::sort_dunder_slots(checker, binding) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::UsedDummyVariable) {
|
||||
ruff::rules::used_dummy_variable(checker, binding, binding_id);
|
||||
if let Some(diagnostic) = ruff::rules::used_dummy_variable(checker, binding, binding_id)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::AssignmentInAssert) {
|
||||
ruff::rules::assignment_in_assert(checker, binding);
|
||||
if let Some(diagnostic) = ruff::rules::assignment_in_assert(checker, binding) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::PytestUnittestRaisesAssertion) {
|
||||
flake8_pytest_style::rules::unittest_raises_assertion_binding(checker, binding);
|
||||
if let Some(diagnostic) =
|
||||
flake8_pytest_style::rules::unittest_raises_assertion_binding(checker, binding)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::ForLoopWrites) {
|
||||
refurb::rules::for_loop_writes_binding(checker, binding);
|
||||
if let Some(diagnostic) = refurb::rules::for_loop_writes_binding(checker, binding) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::CustomTypeVarForSelf) {
|
||||
flake8_pyi::rules::custom_type_var_instead_of_self(checker, binding);
|
||||
if let Some(diagnostic) =
|
||||
flake8_pyi::rules::custom_type_var_instead_of_self(checker, binding)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::PrivateTypeParameter) {
|
||||
pyupgrade::rules::private_type_parameter(checker, binding);
|
||||
if let Some(diagnostic) = pyupgrade::rules::private_type_parameter(checker, binding) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use ruff_diagnostics::{Diagnostic, Fix};
|
||||
use ruff_python_semantic::analyze::visibility;
|
||||
use ruff_python_semantic::{Binding, BindingKind, Imported, ResolvedReference, ScopeKind};
|
||||
use ruff_text_size::Ranged;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::Fix;
|
||||
use crate::checkers::ast::Checker;
|
||||
use crate::codes::Rule;
|
||||
use crate::fix;
|
||||
@@ -112,12 +112,12 @@ pub(crate) fn deferred_scopes(checker: &Checker) {
|
||||
.map(|id| checker.semantic.reference(*id))
|
||||
.all(ResolvedReference::is_load)
|
||||
{
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pylint::rules::GlobalVariableNotAssigned {
|
||||
name: (*name).to_string(),
|
||||
},
|
||||
binding.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,12 +146,12 @@ pub(crate) fn deferred_scopes(checker: &Checker) {
|
||||
if scope.kind.is_generator() {
|
||||
continue;
|
||||
}
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pylint::rules::RedefinedArgumentFromLocal {
|
||||
name: name.to_string(),
|
||||
},
|
||||
binding.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -186,13 +186,13 @@ pub(crate) fn deferred_scopes(checker: &Checker) {
|
||||
continue;
|
||||
}
|
||||
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pyflakes::rules::ImportShadowedByLoopVar {
|
||||
name: name.to_string(),
|
||||
row: checker.compute_source_row(shadowed.start()),
|
||||
},
|
||||
binding.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,7 +331,7 @@ pub(crate) fn deferred_scopes(checker: &Checker) {
|
||||
// Create diagnostics for each statement.
|
||||
for (source, entries) in &redefinitions {
|
||||
for (shadowed, binding) in entries {
|
||||
let mut diagnostic = checker.report_diagnostic(
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
pyflakes::rules::RedefinedWhileUnused {
|
||||
name: binding.name(checker.source()).to_string(),
|
||||
row: checker.compute_source_row(shadowed.start()),
|
||||
@@ -346,6 +346,8 @@ pub(crate) fn deferred_scopes(checker: &Checker) {
|
||||
if let Some(fix) = source.as_ref().and_then(|source| fixes.get(source)) {
|
||||
diagnostic.set_fix(fix.clone());
|
||||
}
|
||||
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,14 @@ pub(crate) fn except_handler(except_handler: &ExceptHandler, checker: &Checker)
|
||||
range: _,
|
||||
}) => {
|
||||
if checker.enabled(Rule::BareExcept) {
|
||||
pycodestyle::rules::bare_except(checker, type_.as_deref(), body, except_handler);
|
||||
if let Some(diagnostic) = pycodestyle::rules::bare_except(
|
||||
type_.as_deref(),
|
||||
body,
|
||||
except_handler,
|
||||
checker.locator,
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::RaiseWithoutFromInsideExcept) {
|
||||
flake8_bugbear::rules::raise_without_from_inside_except(
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use ruff_python_ast::{self as ast, Arguments, Expr, ExprContext, Operator};
|
||||
use ruff_python_literal::cformat::{CFormatError, CFormatErrorType};
|
||||
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
|
||||
use ruff_python_ast::types::Node;
|
||||
use ruff_python_semantic::ScopeKind;
|
||||
use ruff_python_semantic::analyze::typing;
|
||||
@@ -176,9 +178,6 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
|
||||
if checker.enabled(Rule::Airflow3Removal) {
|
||||
airflow::rules::airflow_3_removal_expr(checker, expr);
|
||||
}
|
||||
if checker.enabled(Rule::MissingMaxsplitArg) {
|
||||
pylint::rules::missing_maxsplit_arg(checker, value, slice, expr);
|
||||
}
|
||||
pandas_vet::rules::subscript(checker, value, expr);
|
||||
}
|
||||
Expr::Tuple(ast::ExprTuple {
|
||||
@@ -196,13 +195,14 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
|
||||
let check_too_many_expressions = checker.enabled(Rule::ExpressionsInStarAssignment);
|
||||
let check_two_starred_expressions =
|
||||
checker.enabled(Rule::MultipleStarredExpressions);
|
||||
pyflakes::rules::starred_expressions(
|
||||
checker,
|
||||
if let Some(diagnostic) = pyflakes::rules::starred_expressions(
|
||||
elts,
|
||||
check_too_many_expressions,
|
||||
check_two_starred_expressions,
|
||||
expr.range(),
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
Expr::Name(ast::ExprName { id, ctx, range }) => {
|
||||
@@ -527,12 +527,12 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
|
||||
match pyflakes::format::FormatSummary::try_from(string_value.to_str()) {
|
||||
Err(e) => {
|
||||
if checker.enabled(Rule::StringDotFormatInvalidFormat) {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pyflakes::rules::StringDotFormatInvalidFormat {
|
||||
message: pyflakes::format::error_to_string(&e),
|
||||
},
|
||||
location,
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok(summary) => {
|
||||
@@ -936,7 +936,9 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
|
||||
pylint::rules::repeated_keyword_argument(checker, call);
|
||||
}
|
||||
if checker.enabled(Rule::PytestPatchWithLambda) {
|
||||
flake8_pytest_style::rules::patch_with_lambda(checker, call);
|
||||
if let Some(diagnostic) = flake8_pytest_style::rules::patch_with_lambda(call) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.any_enabled(&[
|
||||
Rule::PytestParametrizeNamesWrongType,
|
||||
@@ -1039,7 +1041,6 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
|
||||
Rule::OsPathGetctime,
|
||||
Rule::Glob,
|
||||
Rule::OsListdir,
|
||||
Rule::OsSymlink,
|
||||
]) {
|
||||
flake8_use_pathlib::rules::replaceable_by_pathlib(checker, call);
|
||||
}
|
||||
@@ -1284,22 +1285,22 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
|
||||
..
|
||||
}) => {
|
||||
if checker.enabled(Rule::PercentFormatUnsupportedFormatCharacter) {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pyflakes::rules::PercentFormatUnsupportedFormatCharacter {
|
||||
char: c,
|
||||
},
|
||||
location,
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
if checker.enabled(Rule::PercentFormatInvalidFormat) {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pyflakes::rules::PercentFormatInvalidFormat {
|
||||
message: e.to_string(),
|
||||
},
|
||||
location,
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok(summary) => {
|
||||
@@ -1363,7 +1364,13 @@ pub(crate) fn expression(expr: &Expr, checker: &Checker) {
|
||||
op: Operator::Add, ..
|
||||
}) => {
|
||||
if checker.enabled(Rule::ExplicitStringConcatenation) {
|
||||
flake8_implicit_str_concat::rules::explicit(checker, expr);
|
||||
if let Some(diagnostic) = flake8_implicit_str_concat::rules::explicit(
|
||||
expr,
|
||||
checker.locator,
|
||||
checker.settings,
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::CollectionLiteralConcatenation) {
|
||||
ruff::rules::collection_literal_concatenation(checker, expr);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_python_ast::helpers;
|
||||
use ruff_python_ast::types::Node;
|
||||
use ruff_python_ast::{self as ast, Expr, Stmt};
|
||||
@@ -38,12 +39,12 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
if !checker.semantic.scope_id.is_global() {
|
||||
for name in names {
|
||||
if checker.semantic.nonlocal(name).is_none() {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pylint::rules::NonlocalWithoutBinding {
|
||||
name: name.to_string(),
|
||||
},
|
||||
name.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,20 +55,22 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
}
|
||||
Stmt::Break(_) => {
|
||||
if checker.enabled(Rule::BreakOutsideLoop) {
|
||||
pyflakes::rules::break_outside_loop(
|
||||
checker,
|
||||
if let Some(diagnostic) = pyflakes::rules::break_outside_loop(
|
||||
stmt,
|
||||
&mut checker.semantic.current_statements().skip(1),
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
Stmt::Continue(_) => {
|
||||
if checker.enabled(Rule::ContinueOutsideLoop) {
|
||||
pyflakes::rules::continue_outside_loop(
|
||||
checker,
|
||||
if let Some(diagnostic) = pyflakes::rules::continue_outside_loop(
|
||||
stmt,
|
||||
&mut checker.semantic.current_statements().skip(1),
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
Stmt::FunctionDef(
|
||||
@@ -95,7 +98,9 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
fastapi::rules::fastapi_unused_path_parameter(checker, function_def);
|
||||
}
|
||||
if checker.enabled(Rule::AmbiguousFunctionName) {
|
||||
pycodestyle::rules::ambiguous_function_name(checker, name);
|
||||
if let Some(diagnostic) = pycodestyle::rules::ambiguous_function_name(name) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::InvalidBoolReturnType) {
|
||||
pylint::rules::invalid_bool_return(checker, function_def);
|
||||
@@ -116,14 +121,15 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
pylint::rules::invalid_str_return(checker, function_def);
|
||||
}
|
||||
if checker.enabled(Rule::InvalidFunctionName) {
|
||||
pep8_naming::rules::invalid_function_name(
|
||||
checker,
|
||||
if let Some(diagnostic) = pep8_naming::rules::invalid_function_name(
|
||||
stmt,
|
||||
name,
|
||||
decorator_list,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
&checker.semantic,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.source_type.is_stub() {
|
||||
if checker.enabled(Rule::PassStatementStubBody) {
|
||||
@@ -173,13 +179,14 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
flake8_pyi::rules::pep_484_positional_parameter(checker, function_def);
|
||||
}
|
||||
if checker.enabled(Rule::DunderFunctionName) {
|
||||
pep8_naming::rules::dunder_function_name(
|
||||
checker,
|
||||
if let Some(diagnostic) = pep8_naming::rules::dunder_function_name(
|
||||
checker.semantic.current_scope(),
|
||||
stmt,
|
||||
name,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::GlobalStatement) {
|
||||
pylint::rules::global_statement(checker, name);
|
||||
@@ -224,13 +231,14 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
);
|
||||
}
|
||||
if checker.enabled(Rule::ComplexStructure) {
|
||||
mccabe::rules::function_is_too_complex(
|
||||
checker,
|
||||
if let Some(diagnostic) = mccabe::rules::function_is_too_complex(
|
||||
stmt,
|
||||
name,
|
||||
body,
|
||||
checker.settings.mccabe.max_complexity,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::HardcodedPasswordDefault) {
|
||||
flake8_bandit::rules::hardcoded_password_default(checker, parameters);
|
||||
@@ -250,28 +258,31 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
pylint::rules::too_many_positional_arguments(checker, function_def);
|
||||
}
|
||||
if checker.enabled(Rule::TooManyReturnStatements) {
|
||||
pylint::rules::too_many_return_statements(
|
||||
checker,
|
||||
if let Some(diagnostic) = pylint::rules::too_many_return_statements(
|
||||
stmt,
|
||||
body,
|
||||
checker.settings.pylint.max_returns,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::TooManyBranches) {
|
||||
pylint::rules::too_many_branches(
|
||||
checker,
|
||||
if let Some(diagnostic) = pylint::rules::too_many_branches(
|
||||
stmt,
|
||||
body,
|
||||
checker.settings.pylint.max_branches,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::TooManyStatements) {
|
||||
pylint::rules::too_many_statements(
|
||||
checker,
|
||||
if let Some(diagnostic) = pylint::rules::too_many_statements(
|
||||
stmt,
|
||||
body,
|
||||
checker.settings.pylint.max_statements,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.any_enabled(&[
|
||||
Rule::PytestFixtureIncorrectParenthesesStyle,
|
||||
@@ -428,9 +439,6 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
if checker.enabled(Rule::UselessObjectInheritance) {
|
||||
pyupgrade::rules::useless_object_inheritance(checker, class_def);
|
||||
}
|
||||
if checker.enabled(Rule::UselessClassMetaclassType) {
|
||||
pyupgrade::rules::useless_class_metaclass_type(checker, class_def);
|
||||
}
|
||||
if checker.enabled(Rule::ReplaceStrEnum) {
|
||||
if checker.target_version() >= PythonVersion::PY311 {
|
||||
pyupgrade::rules::replace_str_enum(checker, class_def);
|
||||
@@ -440,24 +448,28 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
pyupgrade::rules::unnecessary_class_parentheses(checker, class_def);
|
||||
}
|
||||
if checker.enabled(Rule::AmbiguousClassName) {
|
||||
pycodestyle::rules::ambiguous_class_name(checker, name);
|
||||
if let Some(diagnostic) = pycodestyle::rules::ambiguous_class_name(name) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::InvalidClassName) {
|
||||
pep8_naming::rules::invalid_class_name(
|
||||
checker,
|
||||
if let Some(diagnostic) = pep8_naming::rules::invalid_class_name(
|
||||
stmt,
|
||||
name,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::ErrorSuffixOnExceptionName) {
|
||||
pep8_naming::rules::error_suffix_on_exception_name(
|
||||
checker,
|
||||
if let Some(diagnostic) = pep8_naming::rules::error_suffix_on_exception_name(
|
||||
stmt,
|
||||
arguments.as_deref(),
|
||||
name,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if !checker.source_type.is_stub() {
|
||||
if checker.any_enabled(&[
|
||||
@@ -596,7 +608,11 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
}
|
||||
|
||||
if checker.enabled(Rule::Debugger) {
|
||||
flake8_debugger::rules::debugger_import(checker, stmt, None, &alias.name);
|
||||
if let Some(diagnostic) =
|
||||
flake8_debugger::rules::debugger_import(stmt, None, &alias.name)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::BannedApi) {
|
||||
flake8_tidy_imports::rules::banned_api(
|
||||
@@ -619,74 +635,94 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
pylint::rules::manual_from_import(checker, stmt, alias, names);
|
||||
}
|
||||
if checker.enabled(Rule::ImportSelf) {
|
||||
pylint::rules::import_self(checker, alias, checker.module.qualified_name());
|
||||
if let Some(diagnostic) =
|
||||
pylint::rules::import_self(alias, checker.module.qualified_name())
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if let Some(asname) = &alias.asname {
|
||||
let name = alias.name.split('.').next_back().unwrap();
|
||||
if checker.enabled(Rule::ConstantImportedAsNonConstant) {
|
||||
pep8_naming::rules::constant_imported_as_non_constant(
|
||||
checker,
|
||||
name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
if let Some(diagnostic) =
|
||||
pep8_naming::rules::constant_imported_as_non_constant(
|
||||
name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::LowercaseImportedAsNonLowercase) {
|
||||
pep8_naming::rules::lowercase_imported_as_non_lowercase(
|
||||
checker,
|
||||
name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
if let Some(diagnostic) =
|
||||
pep8_naming::rules::lowercase_imported_as_non_lowercase(
|
||||
name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::CamelcaseImportedAsLowercase) {
|
||||
pep8_naming::rules::camelcase_imported_as_lowercase(
|
||||
checker,
|
||||
name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
if let Some(diagnostic) =
|
||||
pep8_naming::rules::camelcase_imported_as_lowercase(
|
||||
name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::CamelcaseImportedAsConstant) {
|
||||
pep8_naming::rules::camelcase_imported_as_constant(
|
||||
checker,
|
||||
if let Some(diagnostic) = pep8_naming::rules::camelcase_imported_as_constant(
|
||||
name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::CamelcaseImportedAsAcronym) {
|
||||
pep8_naming::rules::camelcase_imported_as_acronym(
|
||||
if let Some(diagnostic) = pep8_naming::rules::camelcase_imported_as_acronym(
|
||||
name, asname, alias, stmt, checker,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::BannedImportAlias) {
|
||||
if let Some(asname) = &alias.asname {
|
||||
flake8_import_conventions::rules::banned_import_alias(
|
||||
checker,
|
||||
stmt,
|
||||
&alias.name,
|
||||
asname,
|
||||
&checker.settings.flake8_import_conventions.banned_aliases,
|
||||
);
|
||||
if let Some(diagnostic) =
|
||||
flake8_import_conventions::rules::banned_import_alias(
|
||||
stmt,
|
||||
&alias.name,
|
||||
asname,
|
||||
&checker.settings.flake8_import_conventions.banned_aliases,
|
||||
)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::PytestIncorrectPytestImport) {
|
||||
flake8_pytest_style::rules::import(
|
||||
checker,
|
||||
if let Some(diagnostic) = flake8_pytest_style::rules::import(
|
||||
stmt,
|
||||
&alias.name,
|
||||
alias.asname.as_deref(),
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::BuiltinImportShadowing) {
|
||||
flake8_builtins::rules::builtin_import_shadowing(checker, alias);
|
||||
@@ -798,7 +834,11 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
}
|
||||
|
||||
if checker.enabled(Rule::PytestIncorrectPytestImport) {
|
||||
flake8_pytest_style::rules::import_from(checker, stmt, module, level);
|
||||
if let Some(diagnostic) =
|
||||
flake8_pytest_style::rules::import_from(stmt, module, level)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.source_type.is_stub() {
|
||||
if checker.enabled(Rule::FutureAnnotationsInStub) {
|
||||
@@ -813,98 +853,119 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
} else if &alias.name == "*" {
|
||||
if checker.enabled(Rule::UndefinedLocalWithNestedImportStarUsage) {
|
||||
if !matches!(checker.semantic.current_scope().kind, ScopeKind::Module) {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pyflakes::rules::UndefinedLocalWithNestedImportStarUsage {
|
||||
name: helpers::format_import_from(level, module).to_string(),
|
||||
},
|
||||
stmt.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::UndefinedLocalWithImportStar) {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pyflakes::rules::UndefinedLocalWithImportStar {
|
||||
name: helpers::format_import_from(level, module).to_string(),
|
||||
},
|
||||
stmt.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::RelativeImports) {
|
||||
flake8_tidy_imports::rules::banned_relative_import(
|
||||
if let Some(diagnostic) = flake8_tidy_imports::rules::banned_relative_import(
|
||||
checker,
|
||||
stmt,
|
||||
level,
|
||||
module,
|
||||
checker.module.qualified_name(),
|
||||
checker.settings.flake8_tidy_imports.ban_relative_imports,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::Debugger) {
|
||||
flake8_debugger::rules::debugger_import(checker, stmt, module, &alias.name);
|
||||
if let Some(diagnostic) =
|
||||
flake8_debugger::rules::debugger_import(stmt, module, &alias.name)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::BannedImportAlias) {
|
||||
if let Some(asname) = &alias.asname {
|
||||
let qualified_name =
|
||||
helpers::format_import_from_member(level, module, &alias.name);
|
||||
flake8_import_conventions::rules::banned_import_alias(
|
||||
checker,
|
||||
stmt,
|
||||
&qualified_name,
|
||||
asname,
|
||||
&checker.settings.flake8_import_conventions.banned_aliases,
|
||||
);
|
||||
if let Some(diagnostic) =
|
||||
flake8_import_conventions::rules::banned_import_alias(
|
||||
stmt,
|
||||
&qualified_name,
|
||||
asname,
|
||||
&checker.settings.flake8_import_conventions.banned_aliases,
|
||||
)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(asname) = &alias.asname {
|
||||
if checker.enabled(Rule::ConstantImportedAsNonConstant) {
|
||||
pep8_naming::rules::constant_imported_as_non_constant(
|
||||
checker,
|
||||
&alias.name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
if let Some(diagnostic) =
|
||||
pep8_naming::rules::constant_imported_as_non_constant(
|
||||
&alias.name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::LowercaseImportedAsNonLowercase) {
|
||||
pep8_naming::rules::lowercase_imported_as_non_lowercase(
|
||||
checker,
|
||||
&alias.name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
if let Some(diagnostic) =
|
||||
pep8_naming::rules::lowercase_imported_as_non_lowercase(
|
||||
&alias.name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::CamelcaseImportedAsLowercase) {
|
||||
pep8_naming::rules::camelcase_imported_as_lowercase(
|
||||
checker,
|
||||
&alias.name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
if let Some(diagnostic) =
|
||||
pep8_naming::rules::camelcase_imported_as_lowercase(
|
||||
&alias.name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::CamelcaseImportedAsConstant) {
|
||||
pep8_naming::rules::camelcase_imported_as_constant(
|
||||
checker,
|
||||
if let Some(diagnostic) = pep8_naming::rules::camelcase_imported_as_constant(
|
||||
&alias.name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
&checker.settings.pep8_naming.ignore_names,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::CamelcaseImportedAsAcronym) {
|
||||
pep8_naming::rules::camelcase_imported_as_acronym(
|
||||
if let Some(diagnostic) = pep8_naming::rules::camelcase_imported_as_acronym(
|
||||
&alias.name,
|
||||
asname,
|
||||
alias,
|
||||
stmt,
|
||||
checker,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if !checker.source_type.is_stub() {
|
||||
if checker.enabled(Rule::UselessImportAlias) {
|
||||
@@ -917,21 +978,23 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::ImportSelf) {
|
||||
pylint::rules::import_from_self(
|
||||
checker,
|
||||
if let Some(diagnostic) = pylint::rules::import_from_self(
|
||||
level,
|
||||
module,
|
||||
names,
|
||||
checker.module.qualified_name(),
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::BannedImportFrom) {
|
||||
flake8_import_conventions::rules::banned_import_from(
|
||||
checker,
|
||||
if let Some(diagnostic) = flake8_import_conventions::rules::banned_import_from(
|
||||
stmt,
|
||||
&helpers::format_import_from(level, module),
|
||||
&checker.settings.flake8_import_conventions.banned_from,
|
||||
);
|
||||
) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::ByteStringUsage) {
|
||||
flake8_pyi::rules::bytestring_import(checker, import_from);
|
||||
@@ -1146,7 +1209,7 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
) => {
|
||||
if !checker.semantic.in_type_checking_block() {
|
||||
if checker.enabled(Rule::Assert) {
|
||||
flake8_bandit::rules::assert_used(checker, stmt);
|
||||
checker.report_diagnostic(flake8_bandit::rules::assert_used(stmt));
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::AssertTuple) {
|
||||
@@ -1343,7 +1406,11 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::DefaultExceptNotLast) {
|
||||
pyflakes::rules::default_except_not_last(checker, handlers, checker.locator);
|
||||
if let Some(diagnostic) =
|
||||
pyflakes::rules::default_except_not_last(handlers, checker.locator)
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.any_enabled(&[
|
||||
Rule::DuplicateHandlerException,
|
||||
@@ -1438,7 +1505,9 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
);
|
||||
}
|
||||
if checker.enabled(Rule::PandasDfVariableName) {
|
||||
pandas_vet::rules::assignment_to_df(checker, targets);
|
||||
if let Some(diagnostic) = pandas_vet::rules::assignment_to_df(targets) {
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker
|
||||
.settings
|
||||
@@ -1632,7 +1701,11 @@ pub(crate) fn statement(stmt: &Stmt, checker: &mut Checker) {
|
||||
pylint::rules::named_expr_without_context(checker, value);
|
||||
}
|
||||
if checker.enabled(Rule::AsyncioDanglingTask) {
|
||||
ruff::rules::asyncio_dangling_task(checker, value, checker.semantic());
|
||||
if let Some(diagnostic) =
|
||||
ruff::rules::asyncio_dangling_task(value, checker.semantic())
|
||||
{
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
if checker.enabled(Rule::RepeatedAppend) {
|
||||
refurb::rules::repeated_append(checker, stmt);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_python_semantic::Exceptions;
|
||||
use ruff_python_stdlib::builtins::version_builtin_was_added;
|
||||
|
||||
@@ -14,12 +15,12 @@ pub(crate) fn unresolved_references(checker: &Checker) {
|
||||
for reference in checker.semantic.unresolved_references() {
|
||||
if reference.is_wildcard_import() {
|
||||
if checker.enabled(Rule::UndefinedLocalWithImportStarUsage) {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pyflakes::rules::UndefinedLocalWithImportStarUsage {
|
||||
name: reference.name(checker.source()).to_string(),
|
||||
},
|
||||
reference.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
} else {
|
||||
if checker.enabled(Rule::UndefinedName) {
|
||||
@@ -41,13 +42,13 @@ pub(crate) fn unresolved_references(checker: &Checker) {
|
||||
|
||||
let symbol_name = reference.name(checker.source());
|
||||
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
pyflakes::rules::UndefinedName {
|
||||
name: symbol_name.to_string(),
|
||||
minor_version_builtin_added: version_builtin_was_added(symbol_name),
|
||||
},
|
||||
reference.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,12 @@ use std::path::Path;
|
||||
|
||||
use itertools::Itertools;
|
||||
use log::debug;
|
||||
use ruff_python_parser::semantic_errors::{
|
||||
SemanticSyntaxChecker, SemanticSyntaxContext, SemanticSyntaxError, SemanticSyntaxErrorKind,
|
||||
};
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
|
||||
use ruff_diagnostics::IsolationLevel;
|
||||
use ruff_diagnostics::{Diagnostic, Edit, IsolationLevel};
|
||||
use ruff_notebook::{CellOffsets, NotebookIndex};
|
||||
use ruff_python_ast::helpers::{collect_import_from_member, is_docstring_stmt, to_module_path};
|
||||
use ruff_python_ast::identifier::Identifier;
|
||||
@@ -37,15 +40,12 @@ use ruff_python_ast::str::Quote;
|
||||
use ruff_python_ast::visitor::{Visitor, walk_except_handler, walk_pattern};
|
||||
use ruff_python_ast::{
|
||||
self as ast, AnyParameterRef, ArgOrKeyword, Comprehension, ElifElseClause, ExceptHandler, Expr,
|
||||
ExprContext, InterpolatedStringElement, Keyword, MatchCase, ModModule, Parameter, Parameters,
|
||||
Pattern, PythonVersion, Stmt, Suite, UnaryOp,
|
||||
ExprContext, FStringElement, Keyword, MatchCase, ModModule, Parameter, Parameters, Pattern,
|
||||
PythonVersion, Stmt, Suite, UnaryOp,
|
||||
};
|
||||
use ruff_python_ast::{PySourceType, helpers, str, visitor};
|
||||
use ruff_python_codegen::{Generator, Stylist};
|
||||
use ruff_python_index::Indexer;
|
||||
use ruff_python_parser::semantic_errors::{
|
||||
SemanticSyntaxChecker, SemanticSyntaxContext, SemanticSyntaxError, SemanticSyntaxErrorKind,
|
||||
};
|
||||
use ruff_python_parser::typing::{AnnotationKind, ParsedAnnotation, parse_type_annotation};
|
||||
use ruff_python_parser::{ParseError, Parsed, Tokens};
|
||||
use ruff_python_semantic::all::{DunderAllDefinition, DunderAllFlags};
|
||||
@@ -57,7 +57,7 @@ use ruff_python_semantic::{
|
||||
};
|
||||
use ruff_python_stdlib::builtins::{MAGIC_GLOBALS, python_builtins};
|
||||
use ruff_python_trivia::CommentRanges;
|
||||
use ruff_source_file::{OneIndexed, SourceFile, SourceRow};
|
||||
use ruff_source_file::{OneIndexed, SourceRow};
|
||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
|
||||
use crate::checkers::ast::annotation::AnnotationContext;
|
||||
@@ -66,14 +66,13 @@ use crate::importer::{ImportRequest, Importer, ResolutionError};
|
||||
use crate::noqa::NoqaMapping;
|
||||
use crate::package::PackageRoot;
|
||||
use crate::preview::{is_semantic_errors_enabled, is_undefined_export_in_dunder_init_enabled};
|
||||
use crate::registry::{AsRule, Rule};
|
||||
use crate::registry::Rule;
|
||||
use crate::rules::pyflakes::rules::{
|
||||
LateFutureImport, ReturnOutsideFunction, YieldOutsideFunction,
|
||||
};
|
||||
use crate::rules::pylint::rules::{AwaitOutsideAsync, LoadBeforeGlobalDeclaration};
|
||||
use crate::rules::{flake8_pyi, flake8_type_checking, pyflakes, pyupgrade};
|
||||
use crate::settings::{LinterSettings, TargetVersion, flags};
|
||||
use crate::{Edit, OldDiagnostic, Violation};
|
||||
use crate::{Locator, docstrings, noqa};
|
||||
|
||||
mod analyze;
|
||||
@@ -224,6 +223,8 @@ pub(crate) struct Checker<'a> {
|
||||
visit: deferred::Visit<'a>,
|
||||
/// A set of deferred nodes to be analyzed after the AST traversal (e.g., `for` loops).
|
||||
analyze: deferred::Analyze,
|
||||
/// The cumulative set of diagnostics computed across all lint rules.
|
||||
diagnostics: RefCell<Vec<Diagnostic>>,
|
||||
/// The list of names already seen by flake8-bugbear diagnostics, to avoid duplicate violations.
|
||||
flake8_bugbear_seen: RefCell<FxHashSet<TextRange>>,
|
||||
/// The end offset of the last visited statement.
|
||||
@@ -237,7 +238,6 @@ pub(crate) struct Checker<'a> {
|
||||
semantic_checker: SemanticSyntaxChecker,
|
||||
/// Errors collected by the `semantic_checker`.
|
||||
semantic_errors: RefCell<Vec<SemanticSyntaxError>>,
|
||||
context: &'a LintContext<'a>,
|
||||
}
|
||||
|
||||
impl<'a> Checker<'a> {
|
||||
@@ -258,7 +258,6 @@ impl<'a> Checker<'a> {
|
||||
cell_offsets: Option<&'a CellOffsets>,
|
||||
notebook_index: Option<&'a NotebookIndex>,
|
||||
target_version: TargetVersion,
|
||||
context: &'a LintContext<'a>,
|
||||
) -> Checker<'a> {
|
||||
let semantic = SemanticModel::new(&settings.typing_modules, path, module);
|
||||
Self {
|
||||
@@ -279,6 +278,7 @@ impl<'a> Checker<'a> {
|
||||
semantic,
|
||||
visit: deferred::Visit::default(),
|
||||
analyze: deferred::Analyze::default(),
|
||||
diagnostics: RefCell::default(),
|
||||
flake8_bugbear_seen: RefCell::default(),
|
||||
cell_offsets,
|
||||
notebook_index,
|
||||
@@ -287,7 +287,6 @@ impl<'a> Checker<'a> {
|
||||
target_version,
|
||||
semantic_checker: SemanticSyntaxChecker::new(),
|
||||
semantic_errors: RefCell::default(),
|
||||
context,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -338,7 +337,6 @@ impl<'a> Checker<'a> {
|
||||
ast::BytesLiteralFlags::empty().with_quote_style(self.preferred_quote())
|
||||
}
|
||||
|
||||
// TODO(dylan) add similar method for t-strings
|
||||
/// Return the default f-string flags a generated `FString` node should use, given where we are
|
||||
/// in the AST.
|
||||
pub(crate) fn default_fstring_flags(&self) -> ast::FStringFlags {
|
||||
@@ -381,30 +379,10 @@ impl<'a> Checker<'a> {
|
||||
self.indexer.comment_ranges()
|
||||
}
|
||||
|
||||
/// Return a [`DiagnosticGuard`] for reporting a diagnostic.
|
||||
///
|
||||
/// The guard derefs to a [`Diagnostic`], so it can be used to further modify the diagnostic
|
||||
/// before it is added to the collection in the checker on `Drop`.
|
||||
pub(crate) fn report_diagnostic<'chk, T: Violation>(
|
||||
&'chk self,
|
||||
kind: T,
|
||||
range: TextRange,
|
||||
) -> DiagnosticGuard<'chk, 'a> {
|
||||
self.context.report_diagnostic(kind, range)
|
||||
}
|
||||
|
||||
/// Return a [`DiagnosticGuard`] for reporting a diagnostic if the corresponding rule is
|
||||
/// enabled.
|
||||
///
|
||||
/// Prefer [`Checker::report_diagnostic`] in general because the conversion from a `Diagnostic`
|
||||
/// to a `Rule` is somewhat expensive.
|
||||
pub(crate) fn report_diagnostic_if_enabled<'chk, T: Violation>(
|
||||
&'chk self,
|
||||
kind: T,
|
||||
range: TextRange,
|
||||
) -> Option<DiagnosticGuard<'chk, 'a>> {
|
||||
self.context
|
||||
.report_diagnostic_if_enabled(kind, range, self.settings)
|
||||
/// Push a new [`Diagnostic`] to the collection in the [`Checker`]
|
||||
pub(crate) fn report_diagnostic(&self, diagnostic: Diagnostic) {
|
||||
let mut diagnostics = self.diagnostics.borrow_mut();
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
|
||||
/// Adds a [`TextRange`] to the set of ranges of variable names
|
||||
@@ -530,9 +508,9 @@ impl<'a> Checker<'a> {
|
||||
}
|
||||
|
||||
/// Push `diagnostic` if the checker is not in a `@no_type_check` context.
|
||||
pub(crate) fn report_type_diagnostic<T: Violation>(&self, kind: T, range: TextRange) {
|
||||
pub(crate) fn report_type_diagnostic(&self, diagnostic: Diagnostic) {
|
||||
if !self.semantic.in_no_type_check() {
|
||||
self.report_diagnostic(kind, range);
|
||||
self.report_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,7 +595,7 @@ impl SemanticSyntaxContext for Checker<'_> {
|
||||
match error.kind {
|
||||
SemanticSyntaxErrorKind::LateFutureImport => {
|
||||
if self.settings.rules.enabled(Rule::LateFutureImport) {
|
||||
self.report_diagnostic(LateFutureImport, error.range);
|
||||
self.report_diagnostic(Diagnostic::new(LateFutureImport, error.range));
|
||||
}
|
||||
}
|
||||
SemanticSyntaxErrorKind::LoadBeforeGlobalDeclaration { name, start } => {
|
||||
@@ -626,28 +604,31 @@ impl SemanticSyntaxContext for Checker<'_> {
|
||||
.rules
|
||||
.enabled(Rule::LoadBeforeGlobalDeclaration)
|
||||
{
|
||||
self.report_diagnostic(
|
||||
self.report_diagnostic(Diagnostic::new(
|
||||
LoadBeforeGlobalDeclaration {
|
||||
name,
|
||||
row: self.compute_source_row(start),
|
||||
},
|
||||
error.range,
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
SemanticSyntaxErrorKind::YieldOutsideFunction(kind) => {
|
||||
if self.settings.rules.enabled(Rule::YieldOutsideFunction) {
|
||||
self.report_diagnostic(YieldOutsideFunction::new(kind), error.range);
|
||||
self.report_diagnostic(Diagnostic::new(
|
||||
YieldOutsideFunction::new(kind),
|
||||
error.range,
|
||||
));
|
||||
}
|
||||
}
|
||||
SemanticSyntaxErrorKind::ReturnOutsideFunction => {
|
||||
if self.settings.rules.enabled(Rule::ReturnOutsideFunction) {
|
||||
self.report_diagnostic(ReturnOutsideFunction, error.range);
|
||||
self.report_diagnostic(Diagnostic::new(ReturnOutsideFunction, error.range));
|
||||
}
|
||||
}
|
||||
SemanticSyntaxErrorKind::AwaitOutsideAsyncFunction(_) => {
|
||||
if self.settings.rules.enabled(Rule::AwaitOutsideAsync) {
|
||||
self.report_diagnostic(AwaitOutsideAsync, error.range);
|
||||
self.report_diagnostic(Diagnostic::new(AwaitOutsideAsync, error.range));
|
||||
}
|
||||
}
|
||||
SemanticSyntaxErrorKind::ReboundComprehensionVariable
|
||||
@@ -1898,10 +1879,6 @@ impl<'a> Visitor<'a> for Checker<'a> {
|
||||
self.semantic.flags |= SemanticModelFlags::F_STRING;
|
||||
visitor::walk_expr(self, expr);
|
||||
}
|
||||
Expr::TString(_) => {
|
||||
self.semantic.flags |= SemanticModelFlags::T_STRING;
|
||||
visitor::walk_expr(self, expr);
|
||||
}
|
||||
Expr::Named(ast::ExprNamed {
|
||||
target,
|
||||
value,
|
||||
@@ -1935,7 +1912,6 @@ impl<'a> Visitor<'a> for Checker<'a> {
|
||||
}
|
||||
Expr::BytesLiteral(bytes_literal) => analyze::string_like(bytes_literal.into(), self),
|
||||
Expr::FString(f_string) => analyze::string_like(f_string.into(), self),
|
||||
Expr::TString(t_string) => analyze::string_like(t_string.into(), self),
|
||||
_ => {}
|
||||
}
|
||||
|
||||
@@ -2125,15 +2101,12 @@ impl<'a> Visitor<'a> for Checker<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_interpolated_string_element(
|
||||
&mut self,
|
||||
interpolated_string_element: &'a InterpolatedStringElement,
|
||||
) {
|
||||
fn visit_f_string_element(&mut self, f_string_element: &'a FStringElement) {
|
||||
let snapshot = self.semantic.flags;
|
||||
if interpolated_string_element.is_interpolation() {
|
||||
self.semantic.flags |= SemanticModelFlags::INTERPOLATED_STRING_REPLACEMENT_FIELD;
|
||||
if f_string_element.is_expression() {
|
||||
self.semantic.flags |= SemanticModelFlags::F_STRING_REPLACEMENT_FIELD;
|
||||
}
|
||||
visitor::walk_interpolated_string_element(self, interpolated_string_element);
|
||||
visitor::walk_f_string_element(self, f_string_element);
|
||||
self.semantic.flags = snapshot;
|
||||
}
|
||||
}
|
||||
@@ -2744,12 +2717,12 @@ impl<'a> Checker<'a> {
|
||||
self.semantic.restore(snapshot);
|
||||
|
||||
if self.enabled(Rule::ForwardAnnotationSyntaxError) {
|
||||
self.report_type_diagnostic(
|
||||
self.report_type_diagnostic(Diagnostic::new(
|
||||
pyflakes::rules::ForwardAnnotationSyntaxError {
|
||||
parse_error: parse_error.error.to_string(),
|
||||
},
|
||||
string_expr.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2890,26 +2863,30 @@ impl<'a> Checker<'a> {
|
||||
} else {
|
||||
if self.semantic.global_scope().uses_star_imports() {
|
||||
if self.enabled(Rule::UndefinedLocalWithImportStarUsage) {
|
||||
self.report_diagnostic(
|
||||
pyflakes::rules::UndefinedLocalWithImportStarUsage {
|
||||
name: name.to_string(),
|
||||
},
|
||||
range,
|
||||
)
|
||||
.set_parent(definition.start());
|
||||
self.diagnostics.get_mut().push(
|
||||
Diagnostic::new(
|
||||
pyflakes::rules::UndefinedLocalWithImportStarUsage {
|
||||
name: name.to_string(),
|
||||
},
|
||||
range,
|
||||
)
|
||||
.with_parent(definition.start()),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if self.enabled(Rule::UndefinedExport) {
|
||||
if is_undefined_export_in_dunder_init_enabled(self.settings)
|
||||
|| !self.path.ends_with("__init__.py")
|
||||
{
|
||||
self.report_diagnostic(
|
||||
pyflakes::rules::UndefinedExport {
|
||||
name: name.to_string(),
|
||||
},
|
||||
range,
|
||||
)
|
||||
.set_parent(definition.start());
|
||||
self.diagnostics.get_mut().push(
|
||||
Diagnostic::new(
|
||||
pyflakes::rules::UndefinedExport {
|
||||
name: name.to_string(),
|
||||
},
|
||||
range,
|
||||
)
|
||||
.with_parent(definition.start()),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2970,8 +2947,7 @@ pub(crate) fn check_ast(
|
||||
cell_offsets: Option<&CellOffsets>,
|
||||
notebook_index: Option<&NotebookIndex>,
|
||||
target_version: TargetVersion,
|
||||
context: &LintContext,
|
||||
) -> Vec<SemanticSyntaxError> {
|
||||
) -> (Vec<Diagnostic>, Vec<SemanticSyntaxError>) {
|
||||
let module_path = package
|
||||
.map(PackageRoot::path)
|
||||
.and_then(|package| to_module_path(package, path));
|
||||
@@ -3011,7 +2987,6 @@ pub(crate) fn check_ast(
|
||||
cell_offsets,
|
||||
notebook_index,
|
||||
target_version,
|
||||
context,
|
||||
);
|
||||
checker.bind_builtins();
|
||||
|
||||
@@ -3038,137 +3013,10 @@ pub(crate) fn check_ast(
|
||||
analyze::deferred_scopes(&checker);
|
||||
|
||||
let Checker {
|
||||
semantic_errors, ..
|
||||
diagnostics,
|
||||
semantic_errors,
|
||||
..
|
||||
} = checker;
|
||||
|
||||
semantic_errors.into_inner()
|
||||
}
|
||||
|
||||
/// A type for collecting diagnostics in a given file.
|
||||
///
|
||||
/// [`LintContext::report_diagnostic`] can be used to obtain a [`DiagnosticGuard`], which will push
|
||||
/// a [`Violation`] to the contained [`OldDiagnostic`] collection on `Drop`.
|
||||
pub(crate) struct LintContext<'a> {
|
||||
diagnostics: RefCell<Vec<OldDiagnostic>>,
|
||||
source_file: &'a SourceFile,
|
||||
}
|
||||
|
||||
impl<'a> LintContext<'a> {
|
||||
/// Create a new collector with the given `source_file` and an empty collection of
|
||||
/// `OldDiagnostic`s.
|
||||
pub(crate) fn new(source_file: &'a SourceFile) -> Self {
|
||||
Self {
|
||||
diagnostics: RefCell::default(),
|
||||
source_file,
|
||||
}
|
||||
}
|
||||
|
||||
/// Return a [`DiagnosticGuard`] for reporting a diagnostic.
|
||||
///
|
||||
/// The guard derefs to an [`OldDiagnostic`], so it can be used to further modify the diagnostic
|
||||
/// before it is added to the collection in the collector on `Drop`.
|
||||
pub(crate) fn report_diagnostic<'chk, T: Violation>(
|
||||
&'chk self,
|
||||
kind: T,
|
||||
range: TextRange,
|
||||
) -> DiagnosticGuard<'chk, 'a> {
|
||||
DiagnosticGuard {
|
||||
context: self,
|
||||
diagnostic: Some(OldDiagnostic::new(kind, range, self.source_file)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Return a [`DiagnosticGuard`] for reporting a diagnostic if the corresponding rule is
|
||||
/// enabled.
|
||||
///
|
||||
/// Prefer [`DiagnosticsCollector::report_diagnostic`] in general because the conversion from an
|
||||
/// `OldDiagnostic` to a `Rule` is somewhat expensive.
|
||||
pub(crate) fn report_diagnostic_if_enabled<'chk, T: Violation>(
|
||||
&'chk self,
|
||||
kind: T,
|
||||
range: TextRange,
|
||||
settings: &LinterSettings,
|
||||
) -> Option<DiagnosticGuard<'chk, 'a>> {
|
||||
let diagnostic = OldDiagnostic::new(kind, range, self.source_file);
|
||||
if settings.rules.enabled(diagnostic.rule()) {
|
||||
Some(DiagnosticGuard {
|
||||
context: self,
|
||||
diagnostic: Some(diagnostic),
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn into_diagnostics(self) -> Vec<OldDiagnostic> {
|
||||
self.diagnostics.into_inner()
|
||||
}
|
||||
|
||||
pub(crate) fn is_empty(&self) -> bool {
|
||||
self.diagnostics.borrow().is_empty()
|
||||
}
|
||||
|
||||
pub(crate) fn as_mut_vec(&mut self) -> &mut Vec<OldDiagnostic> {
|
||||
self.diagnostics.get_mut()
|
||||
}
|
||||
|
||||
pub(crate) fn iter(&mut self) -> impl Iterator<Item = &OldDiagnostic> {
|
||||
self.diagnostics.get_mut().iter()
|
||||
}
|
||||
}
|
||||
|
||||
/// An abstraction for mutating a diagnostic.
|
||||
///
|
||||
/// Callers can build this guard by starting with `Checker::report_diagnostic`.
|
||||
///
|
||||
/// The primary function of this guard is to add the underlying diagnostic to the `Checker`'s list
|
||||
/// of diagnostics on `Drop`, while dereferencing to the underlying diagnostic for mutations like
|
||||
/// adding fixes or parent ranges.
|
||||
pub(crate) struct DiagnosticGuard<'a, 'b> {
|
||||
/// The parent checker that will receive the diagnostic on `Drop`.
|
||||
context: &'a LintContext<'b>,
|
||||
/// The diagnostic that we want to report.
|
||||
///
|
||||
/// This is always `Some` until the `Drop` (or `defuse`) call.
|
||||
diagnostic: Option<OldDiagnostic>,
|
||||
}
|
||||
|
||||
impl DiagnosticGuard<'_, '_> {
|
||||
/// Consume the underlying `Diagnostic` without emitting it.
|
||||
///
|
||||
/// In general you should avoid constructing diagnostics that may not be emitted, but this
|
||||
/// method can be used where this is unavoidable.
|
||||
pub(crate) fn defuse(mut self) {
|
||||
self.diagnostic = None;
|
||||
}
|
||||
}
|
||||
|
||||
impl std::ops::Deref for DiagnosticGuard<'_, '_> {
|
||||
type Target = OldDiagnostic;
|
||||
|
||||
fn deref(&self) -> &OldDiagnostic {
|
||||
// OK because `self.diagnostic` is only `None` within `Drop`.
|
||||
self.diagnostic.as_ref().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
/// Return a mutable borrow of the diagnostic in this guard.
|
||||
impl std::ops::DerefMut for DiagnosticGuard<'_, '_> {
|
||||
fn deref_mut(&mut self) -> &mut OldDiagnostic {
|
||||
// OK because `self.diagnostic` is only `None` within `Drop`.
|
||||
self.diagnostic.as_mut().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for DiagnosticGuard<'_, '_> {
|
||||
fn drop(&mut self) {
|
||||
if std::thread::panicking() {
|
||||
// Don't submit diagnostics when panicking because they might be incomplete.
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(diagnostic) = self.diagnostic.take() {
|
||||
self.context.diagnostics.borrow_mut().push(diagnostic);
|
||||
}
|
||||
}
|
||||
(diagnostics.into_inner(), semantic_errors.into_inner())
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use std::path::Path;
|
||||
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_python_ast::PythonVersion;
|
||||
use ruff_python_trivia::CommentRanges;
|
||||
|
||||
use crate::Locator;
|
||||
use crate::checkers::ast::LintContext;
|
||||
use crate::package::PackageRoot;
|
||||
use crate::preview::is_allow_nested_roots_enabled;
|
||||
use crate::registry::Rule;
|
||||
@@ -20,12 +20,13 @@ pub(crate) fn check_file_path(
|
||||
comment_ranges: &CommentRanges,
|
||||
settings: &LinterSettings,
|
||||
target_version: PythonVersion,
|
||||
context: &LintContext,
|
||||
) {
|
||||
) -> Vec<Diagnostic> {
|
||||
let mut diagnostics: Vec<Diagnostic> = vec![];
|
||||
|
||||
// flake8-no-pep420
|
||||
if settings.rules.enabled(Rule::ImplicitNamespacePackage) {
|
||||
let allow_nested_roots = is_allow_nested_roots_enabled(settings);
|
||||
implicit_namespace_package(
|
||||
if let Some(diagnostic) = implicit_namespace_package(
|
||||
path,
|
||||
package,
|
||||
locator,
|
||||
@@ -33,17 +34,26 @@ pub(crate) fn check_file_path(
|
||||
&settings.project_root,
|
||||
&settings.src,
|
||||
allow_nested_roots,
|
||||
context,
|
||||
);
|
||||
) {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
// pep8-naming
|
||||
if settings.rules.enabled(Rule::InvalidModuleName) {
|
||||
invalid_module_name(path, package, &settings.pep8_naming.ignore_names, context);
|
||||
if let Some(diagnostic) =
|
||||
invalid_module_name(path, package, &settings.pep8_naming.ignore_names)
|
||||
{
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
// flake8-builtins
|
||||
if settings.rules.enabled(Rule::StdlibModuleShadowing) {
|
||||
stdlib_module_shadowing(path, settings, target_version, context);
|
||||
if let Some(diagnostic) = stdlib_module_shadowing(path, settings, target_version) {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
diagnostics
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! Lint rules based on import analysis.
|
||||
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_notebook::CellOffsets;
|
||||
use ruff_python_ast::statement_visitor::StatementVisitor;
|
||||
use ruff_python_ast::{ModModule, PySourceType, PythonVersion};
|
||||
@@ -15,8 +16,6 @@ use crate::rules::isort;
|
||||
use crate::rules::isort::block::{Block, BlockBuilder};
|
||||
use crate::settings::LinterSettings;
|
||||
|
||||
use super::ast::LintContext;
|
||||
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn check_imports(
|
||||
parsed: &Parsed<ModModule>,
|
||||
@@ -29,8 +28,7 @@ pub(crate) fn check_imports(
|
||||
source_type: PySourceType,
|
||||
cell_offsets: Option<&CellOffsets>,
|
||||
target_version: PythonVersion,
|
||||
context: &LintContext,
|
||||
) {
|
||||
) -> Vec<Diagnostic> {
|
||||
// Extract all import blocks from the AST.
|
||||
let tracker = {
|
||||
let mut tracker =
|
||||
@@ -42,10 +40,11 @@ pub(crate) fn check_imports(
|
||||
let blocks: Vec<&Block> = tracker.iter().collect();
|
||||
|
||||
// Enforce import rules.
|
||||
let mut diagnostics = vec![];
|
||||
if settings.rules.enabled(Rule::UnsortedImports) {
|
||||
for block in &blocks {
|
||||
if !block.imports.is_empty() {
|
||||
isort::rules::organize_imports(
|
||||
if let Some(diagnostic) = isort::rules::organize_imports(
|
||||
block,
|
||||
locator,
|
||||
stylist,
|
||||
@@ -55,19 +54,21 @@ pub(crate) fn check_imports(
|
||||
source_type,
|
||||
parsed.tokens(),
|
||||
target_version,
|
||||
context,
|
||||
);
|
||||
) {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if settings.rules.enabled(Rule::MissingRequiredImport) {
|
||||
isort::rules::add_required_imports(
|
||||
diagnostics.extend(isort::rules::add_required_imports(
|
||||
parsed,
|
||||
locator,
|
||||
stylist,
|
||||
settings,
|
||||
source_type,
|
||||
context,
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
diagnostics
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_python_codegen::Stylist;
|
||||
use ruff_python_index::Indexer;
|
||||
use ruff_python_parser::{TokenKind, Tokens};
|
||||
use ruff_source_file::LineRanges;
|
||||
use ruff_text_size::{Ranged, TextRange};
|
||||
|
||||
use crate::Locator;
|
||||
use crate::line_width::IndentWidth;
|
||||
use crate::registry::Rule;
|
||||
use crate::registry::{AsRule, Rule};
|
||||
use crate::rules::pycodestyle::rules::logical_lines::{
|
||||
LogicalLines, TokenFlags, extraneous_whitespace, indentation, missing_whitespace,
|
||||
missing_whitespace_after_keyword, missing_whitespace_around_operator, redundant_backslash,
|
||||
@@ -14,9 +16,6 @@ use crate::rules::pycodestyle::rules::logical_lines::{
|
||||
whitespace_before_parameters,
|
||||
};
|
||||
use crate::settings::LinterSettings;
|
||||
use crate::{Locator, Violation};
|
||||
|
||||
use super::ast::{DiagnosticGuard, LintContext};
|
||||
|
||||
/// Return the amount of indentation, expanding tabs to the next multiple of the settings' tab size.
|
||||
pub(crate) fn expand_indent(line: &str, indent_width: IndentWidth) -> usize {
|
||||
@@ -41,9 +40,8 @@ pub(crate) fn check_logical_lines(
|
||||
indexer: &Indexer,
|
||||
stylist: &Stylist,
|
||||
settings: &LinterSettings,
|
||||
lint_context: &LintContext,
|
||||
) {
|
||||
let mut context = LogicalLinesContext::new(settings, lint_context);
|
||||
) -> Vec<Diagnostic> {
|
||||
let mut context = LogicalLinesContext::new(settings);
|
||||
|
||||
let mut prev_line = None;
|
||||
let mut prev_indent_level = None;
|
||||
@@ -172,7 +170,7 @@ pub(crate) fn check_logical_lines(
|
||||
let indent_size = 4;
|
||||
|
||||
if enforce_indentation {
|
||||
indentation(
|
||||
for diagnostic in indentation(
|
||||
&line,
|
||||
prev_line.as_ref(),
|
||||
indent_char,
|
||||
@@ -180,9 +178,11 @@ pub(crate) fn check_logical_lines(
|
||||
prev_indent_level,
|
||||
indent_size,
|
||||
range,
|
||||
lint_context,
|
||||
settings,
|
||||
);
|
||||
) {
|
||||
if settings.rules.enabled(diagnostic.rule()) {
|
||||
context.push_diagnostic(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !line.is_comment_only() {
|
||||
@@ -190,24 +190,26 @@ pub(crate) fn check_logical_lines(
|
||||
prev_indent_level = Some(indent_level);
|
||||
}
|
||||
}
|
||||
context.diagnostics
|
||||
}
|
||||
|
||||
pub(crate) struct LogicalLinesContext<'a, 'b> {
|
||||
#[derive(Debug, Clone)]
|
||||
pub(crate) struct LogicalLinesContext<'a> {
|
||||
settings: &'a LinterSettings,
|
||||
context: &'a LintContext<'b>,
|
||||
diagnostics: Vec<Diagnostic>,
|
||||
}
|
||||
|
||||
impl<'a, 'b> LogicalLinesContext<'a, 'b> {
|
||||
fn new(settings: &'a LinterSettings, context: &'a LintContext<'b>) -> Self {
|
||||
Self { settings, context }
|
||||
impl<'a> LogicalLinesContext<'a> {
|
||||
fn new(settings: &'a LinterSettings) -> Self {
|
||||
Self {
|
||||
settings,
|
||||
diagnostics: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn report_diagnostic<'chk, T: Violation>(
|
||||
&'chk self,
|
||||
kind: T,
|
||||
range: TextRange,
|
||||
) -> Option<DiagnosticGuard<'chk, 'a>> {
|
||||
self.context
|
||||
.report_diagnostic_if_enabled(kind, range, self.settings)
|
||||
pub(crate) fn push_diagnostic(&mut self, diagnostic: Diagnostic) {
|
||||
if self.settings.rules.enabled(diagnostic.rule()) {
|
||||
self.diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ use std::path::Path;
|
||||
use itertools::Itertools;
|
||||
use rustc_hash::FxHashSet;
|
||||
|
||||
use ruff_diagnostics::{Diagnostic, Edit, Fix};
|
||||
use ruff_python_trivia::CommentRanges;
|
||||
use ruff_text_size::Ranged;
|
||||
|
||||
use crate::Locator;
|
||||
use crate::fix::edits::delete_comment;
|
||||
use crate::noqa::{
|
||||
Code, Directive, FileExemption, FileNoqaDirectives, NoqaDirectives, NoqaMapping,
|
||||
@@ -19,13 +21,10 @@ use crate::rules::pygrep_hooks;
|
||||
use crate::rules::ruff;
|
||||
use crate::rules::ruff::rules::{UnusedCodes, UnusedNOQA};
|
||||
use crate::settings::LinterSettings;
|
||||
use crate::{Edit, Fix, Locator};
|
||||
|
||||
use super::ast::LintContext;
|
||||
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn check_noqa(
|
||||
context: &mut LintContext,
|
||||
diagnostics: &mut Vec<Diagnostic>,
|
||||
path: &Path,
|
||||
locator: &Locator,
|
||||
comment_ranges: &CommentRanges,
|
||||
@@ -47,7 +46,7 @@ pub(crate) fn check_noqa(
|
||||
let mut ignored_diagnostics = vec![];
|
||||
|
||||
// Remove any ignored diagnostics.
|
||||
'outer: for (index, diagnostic) in context.iter().enumerate() {
|
||||
'outer: for (index, diagnostic) in diagnostics.iter().enumerate() {
|
||||
let rule = diagnostic.rule();
|
||||
|
||||
if matches!(rule, Rule::BlanketNOQA) {
|
||||
@@ -136,9 +135,11 @@ pub(crate) fn check_noqa(
|
||||
Directive::All(directive) => {
|
||||
if matches.is_empty() {
|
||||
let edit = delete_comment(directive.range(), locator);
|
||||
let mut diagnostic = context
|
||||
.report_diagnostic(UnusedNOQA { codes: None }, directive.range());
|
||||
let mut diagnostic =
|
||||
Diagnostic::new(UnusedNOQA { codes: None }, directive.range());
|
||||
diagnostic.set_fix(Fix::safe_edit(edit));
|
||||
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
Directive::Codes(directive) => {
|
||||
@@ -158,7 +159,9 @@ pub(crate) fn check_noqa(
|
||||
|
||||
if seen_codes.insert(original_code) {
|
||||
let is_code_used = if is_file_level {
|
||||
context.iter().any(|diag| diag.rule().noqa_code() == code)
|
||||
diagnostics
|
||||
.iter()
|
||||
.any(|diag| diag.rule().noqa_code() == code)
|
||||
} else {
|
||||
matches.iter().any(|match_| *match_ == code)
|
||||
} || settings
|
||||
@@ -209,7 +212,7 @@ pub(crate) fn check_noqa(
|
||||
directive.range(),
|
||||
)
|
||||
};
|
||||
let mut diagnostic = context.report_diagnostic(
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
UnusedNOQA {
|
||||
codes: Some(UnusedCodes {
|
||||
disabled: disabled_codes
|
||||
@@ -233,6 +236,7 @@ pub(crate) fn check_noqa(
|
||||
directive.range(),
|
||||
);
|
||||
diagnostic.set_fix(Fix::safe_edit(edit));
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,8 +247,8 @@ pub(crate) fn check_noqa(
|
||||
&& !per_file_ignores.contains(Rule::RedirectedNOQA)
|
||||
&& !exemption.includes(Rule::RedirectedNOQA)
|
||||
{
|
||||
ruff::rules::redirected_noqa(context, &noqa_directives);
|
||||
ruff::rules::redirected_file_noqa(context, &file_noqa_directives);
|
||||
ruff::rules::redirected_noqa(diagnostics, &noqa_directives);
|
||||
ruff::rules::redirected_file_noqa(diagnostics, &file_noqa_directives);
|
||||
}
|
||||
|
||||
if settings.rules.enabled(Rule::BlanketNOQA)
|
||||
@@ -252,7 +256,7 @@ pub(crate) fn check_noqa(
|
||||
&& !exemption.enumerates(Rule::BlanketNOQA)
|
||||
{
|
||||
pygrep_hooks::rules::blanket_noqa(
|
||||
context,
|
||||
diagnostics,
|
||||
&noqa_directives,
|
||||
locator,
|
||||
&file_noqa_directives,
|
||||
@@ -263,7 +267,7 @@ pub(crate) fn check_noqa(
|
||||
&& !per_file_ignores.contains(Rule::InvalidRuleCode)
|
||||
&& !exemption.enumerates(Rule::InvalidRuleCode)
|
||||
{
|
||||
ruff::rules::invalid_noqa_code(context, &noqa_directives, locator, &settings.external);
|
||||
ruff::rules::invalid_noqa_code(diagnostics, &noqa_directives, locator, &settings.external);
|
||||
}
|
||||
|
||||
ignored_diagnostics.sort_unstable();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! Lint rules based on checking physical lines.
|
||||
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_python_codegen::Stylist;
|
||||
use ruff_python_index::Indexer;
|
||||
use ruff_source_file::UniversalNewlines;
|
||||
@@ -16,16 +17,15 @@ use crate::rules::pylint;
|
||||
use crate::rules::ruff::rules::indented_form_feed;
|
||||
use crate::settings::LinterSettings;
|
||||
|
||||
use super::ast::LintContext;
|
||||
|
||||
pub(crate) fn check_physical_lines(
|
||||
locator: &Locator,
|
||||
stylist: &Stylist,
|
||||
indexer: &Indexer,
|
||||
doc_lines: &[TextSize],
|
||||
settings: &LinterSettings,
|
||||
context: &LintContext,
|
||||
) {
|
||||
) -> Vec<Diagnostic> {
|
||||
let mut diagnostics: Vec<Diagnostic> = vec![];
|
||||
|
||||
let enforce_doc_line_too_long = settings.rules.enabled(Rule::DocLineTooLong);
|
||||
let enforce_line_too_long = settings.rules.enabled(Rule::LineTooLong);
|
||||
let enforce_no_newline_at_end_of_file = settings.rules.enabled(Rule::MissingNewlineAtEndOfFile);
|
||||
@@ -45,38 +45,54 @@ pub(crate) fn check_physical_lines(
|
||||
.is_some()
|
||||
{
|
||||
if enforce_doc_line_too_long {
|
||||
doc_line_too_long(&line, comment_ranges, settings, context);
|
||||
if let Some(diagnostic) = doc_line_too_long(&line, comment_ranges, settings) {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if enforce_mixed_spaces_and_tabs {
|
||||
mixed_spaces_and_tabs(&line, context);
|
||||
if let Some(diagnostic) = mixed_spaces_and_tabs(&line) {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
if enforce_line_too_long {
|
||||
line_too_long(&line, comment_ranges, settings, context);
|
||||
if let Some(diagnostic) = line_too_long(&line, comment_ranges, settings) {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
if enforce_bidirectional_unicode {
|
||||
pylint::rules::bidirectional_unicode(&line, context);
|
||||
diagnostics.extend(pylint::rules::bidirectional_unicode(&line));
|
||||
}
|
||||
|
||||
if enforce_trailing_whitespace || enforce_blank_line_contains_whitespace {
|
||||
trailing_whitespace(&line, locator, indexer, settings, context);
|
||||
if let Some(diagnostic) = trailing_whitespace(&line, locator, indexer, settings) {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
if settings.rules.enabled(Rule::IndentedFormFeed) {
|
||||
indented_form_feed(&line, context);
|
||||
if let Some(diagnostic) = indented_form_feed(&line) {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if enforce_no_newline_at_end_of_file {
|
||||
no_newline_at_end_of_file(locator, stylist, context);
|
||||
if let Some(diagnostic) = no_newline_at_end_of_file(locator, stylist) {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
if enforce_copyright_notice {
|
||||
missing_copyright_notice(locator, settings, context);
|
||||
if let Some(diagnostic) = missing_copyright_notice(locator, settings) {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
|
||||
diagnostics
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -84,10 +100,8 @@ mod tests {
|
||||
use ruff_python_codegen::Stylist;
|
||||
use ruff_python_index::Indexer;
|
||||
use ruff_python_parser::parse_module;
|
||||
use ruff_source_file::SourceFileBuilder;
|
||||
|
||||
use crate::Locator;
|
||||
use crate::checkers::ast::LintContext;
|
||||
use crate::line_width::LineLength;
|
||||
use crate::registry::Rule;
|
||||
use crate::rules::pycodestyle;
|
||||
@@ -104,8 +118,6 @@ mod tests {
|
||||
let stylist = Stylist::from_tokens(parsed.tokens(), locator.contents());
|
||||
|
||||
let check_with_max_line_length = |line_length: LineLength| {
|
||||
let source_file = SourceFileBuilder::new("<filename>", line).finish();
|
||||
let diagnostics = LintContext::new(&source_file);
|
||||
check_physical_lines(
|
||||
&locator,
|
||||
&stylist,
|
||||
@@ -118,9 +130,7 @@ mod tests {
|
||||
},
|
||||
..LinterSettings::for_rule(Rule::LineTooLong)
|
||||
},
|
||||
&diagnostics,
|
||||
);
|
||||
diagnostics.into_diagnostics()
|
||||
)
|
||||
};
|
||||
let line_length = LineLength::try_from(8).unwrap();
|
||||
assert_eq!(check_with_max_line_length(line_length), vec![]);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_notebook::CellOffsets;
|
||||
use ruff_python_ast::PySourceType;
|
||||
use ruff_python_codegen::Stylist;
|
||||
@@ -18,8 +19,6 @@ use crate::rules::{
|
||||
};
|
||||
use crate::settings::LinterSettings;
|
||||
|
||||
use super::ast::LintContext;
|
||||
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub(crate) fn check_tokens(
|
||||
tokens: &Tokens,
|
||||
@@ -30,8 +29,8 @@ pub(crate) fn check_tokens(
|
||||
settings: &LinterSettings,
|
||||
source_type: PySourceType,
|
||||
cell_offsets: Option<&CellOffsets>,
|
||||
context: &mut LintContext,
|
||||
) {
|
||||
) -> Vec<Diagnostic> {
|
||||
let mut diagnostics: Vec<Diagnostic> = vec![];
|
||||
let comment_ranges = indexer.comment_ranges();
|
||||
|
||||
if settings.rules.any_enabled(&[
|
||||
@@ -42,23 +41,16 @@ pub(crate) fn check_tokens(
|
||||
Rule::BlankLinesAfterFunctionOrClass,
|
||||
Rule::BlankLinesBeforeNestedDefinition,
|
||||
]) {
|
||||
BlankLinesChecker::new(
|
||||
locator,
|
||||
stylist,
|
||||
settings,
|
||||
source_type,
|
||||
cell_offsets,
|
||||
context,
|
||||
)
|
||||
.check_lines(tokens);
|
||||
BlankLinesChecker::new(locator, stylist, settings, source_type, cell_offsets)
|
||||
.check_lines(tokens, &mut diagnostics);
|
||||
}
|
||||
|
||||
if settings.rules.enabled(Rule::BlanketTypeIgnore) {
|
||||
pygrep_hooks::rules::blanket_type_ignore(context, comment_ranges, locator);
|
||||
pygrep_hooks::rules::blanket_type_ignore(&mut diagnostics, comment_ranges, locator);
|
||||
}
|
||||
|
||||
if settings.rules.enabled(Rule::EmptyComment) {
|
||||
pylint::rules::empty_comments(context, comment_ranges, locator);
|
||||
pylint::rules::empty_comments(&mut diagnostics, comment_ranges, locator);
|
||||
}
|
||||
|
||||
if settings
|
||||
@@ -66,20 +58,25 @@ pub(crate) fn check_tokens(
|
||||
.enabled(Rule::AmbiguousUnicodeCharacterComment)
|
||||
{
|
||||
for range in comment_ranges {
|
||||
ruff::rules::ambiguous_unicode_character_comment(context, locator, range, settings);
|
||||
ruff::rules::ambiguous_unicode_character_comment(
|
||||
&mut diagnostics,
|
||||
locator,
|
||||
range,
|
||||
settings,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if settings.rules.enabled(Rule::CommentedOutCode) {
|
||||
eradicate::rules::commented_out_code(context, locator, comment_ranges, settings);
|
||||
eradicate::rules::commented_out_code(&mut diagnostics, locator, comment_ranges, settings);
|
||||
}
|
||||
|
||||
if settings.rules.enabled(Rule::UTF8EncodingDeclaration) {
|
||||
pyupgrade::rules::unnecessary_coding_comment(context, locator, comment_ranges);
|
||||
pyupgrade::rules::unnecessary_coding_comment(&mut diagnostics, locator, comment_ranges);
|
||||
}
|
||||
|
||||
if settings.rules.enabled(Rule::TabIndentation) {
|
||||
pycodestyle::rules::tab_indentation(context, locator, indexer);
|
||||
pycodestyle::rules::tab_indentation(&mut diagnostics, locator, indexer);
|
||||
}
|
||||
|
||||
if settings.rules.any_enabled(&[
|
||||
@@ -90,7 +87,7 @@ pub(crate) fn check_tokens(
|
||||
Rule::InvalidCharacterZeroWidthSpace,
|
||||
]) {
|
||||
for token in tokens {
|
||||
pylint::rules::invalid_string_characters(context, token, locator);
|
||||
pylint::rules::invalid_string_characters(&mut diagnostics, token, locator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +97,7 @@ pub(crate) fn check_tokens(
|
||||
Rule::UselessSemicolon,
|
||||
]) {
|
||||
pycodestyle::rules::compound_statements(
|
||||
context,
|
||||
&mut diagnostics,
|
||||
tokens,
|
||||
locator,
|
||||
indexer,
|
||||
@@ -113,7 +110,13 @@ pub(crate) fn check_tokens(
|
||||
Rule::SingleLineImplicitStringConcatenation,
|
||||
Rule::MultiLineImplicitStringConcatenation,
|
||||
]) {
|
||||
flake8_implicit_str_concat::rules::implicit(context, tokens, locator, indexer, settings);
|
||||
flake8_implicit_str_concat::rules::implicit(
|
||||
&mut diagnostics,
|
||||
tokens,
|
||||
locator,
|
||||
indexer,
|
||||
settings,
|
||||
);
|
||||
}
|
||||
|
||||
if settings.rules.any_enabled(&[
|
||||
@@ -121,15 +124,15 @@ pub(crate) fn check_tokens(
|
||||
Rule::TrailingCommaOnBareTuple,
|
||||
Rule::ProhibitedTrailingComma,
|
||||
]) {
|
||||
flake8_commas::rules::trailing_commas(context, tokens, locator, indexer);
|
||||
flake8_commas::rules::trailing_commas(&mut diagnostics, tokens, locator, indexer);
|
||||
}
|
||||
|
||||
if settings.rules.enabled(Rule::ExtraneousParentheses) {
|
||||
pyupgrade::rules::extraneous_parentheses(context, tokens, locator);
|
||||
pyupgrade::rules::extraneous_parentheses(&mut diagnostics, tokens, locator);
|
||||
}
|
||||
|
||||
if source_type.is_stub() && settings.rules.enabled(Rule::TypeCommentInStub) {
|
||||
flake8_pyi::rules::type_comment_in_stub(context, locator, comment_ranges);
|
||||
flake8_pyi::rules::type_comment_in_stub(&mut diagnostics, locator, comment_ranges);
|
||||
}
|
||||
|
||||
if settings.rules.any_enabled(&[
|
||||
@@ -139,7 +142,13 @@ pub(crate) fn check_tokens(
|
||||
Rule::ShebangNotFirstLine,
|
||||
Rule::ShebangMissingPython,
|
||||
]) {
|
||||
flake8_executable::rules::from_tokens(context, path, locator, comment_ranges, settings);
|
||||
flake8_executable::rules::from_tokens(
|
||||
&mut diagnostics,
|
||||
path,
|
||||
locator,
|
||||
comment_ranges,
|
||||
settings,
|
||||
);
|
||||
}
|
||||
|
||||
if settings.rules.any_enabled(&[
|
||||
@@ -163,15 +172,19 @@ pub(crate) fn check_tokens(
|
||||
TodoComment::from_comment(comment, *comment_range, i)
|
||||
})
|
||||
.collect();
|
||||
flake8_todos::rules::todos(context, &todo_comments, locator, comment_ranges);
|
||||
flake8_fixme::rules::todos(context, &todo_comments);
|
||||
flake8_todos::rules::todos(&mut diagnostics, &todo_comments, locator, comment_ranges);
|
||||
flake8_fixme::rules::todos(&mut diagnostics, &todo_comments);
|
||||
}
|
||||
|
||||
if settings.rules.enabled(Rule::TooManyNewlinesAtEndOfFile) {
|
||||
pycodestyle::rules::too_many_newlines_at_end_of_file(context, tokens, cell_offsets);
|
||||
pycodestyle::rules::too_many_newlines_at_end_of_file(
|
||||
&mut diagnostics,
|
||||
tokens,
|
||||
cell_offsets,
|
||||
);
|
||||
}
|
||||
|
||||
context
|
||||
.as_mut_vec()
|
||||
.retain(|diagnostic| settings.rules.enabled(diagnostic.rule()));
|
||||
diagnostics.retain(|diagnostic| settings.rules.enabled(diagnostic.rule()));
|
||||
|
||||
diagnostics
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use std::fmt::Formatter;
|
||||
|
||||
use strum_macros::{AsRefStr, EnumIter};
|
||||
|
||||
use crate::registry::Linter;
|
||||
use crate::registry::{AsRule, Linter};
|
||||
use crate::rule_selector::is_single_rule_selector;
|
||||
use crate::rules;
|
||||
|
||||
@@ -198,7 +198,6 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
||||
(Pylint, "C0132") => (RuleGroup::Stable, rules::pylint::rules::TypeParamNameMismatch),
|
||||
(Pylint, "C0205") => (RuleGroup::Stable, rules::pylint::rules::SingleStringSlots),
|
||||
(Pylint, "C0206") => (RuleGroup::Stable, rules::pylint::rules::DictIndexMissingItems),
|
||||
(Pylint, "C0207") => (RuleGroup::Preview, rules::pylint::rules::MissingMaxsplitArg),
|
||||
(Pylint, "C0208") => (RuleGroup::Stable, rules::pylint::rules::IterationOverSet),
|
||||
(Pylint, "C0414") => (RuleGroup::Stable, rules::pylint::rules::UselessImportAlias),
|
||||
(Pylint, "C0415") => (RuleGroup::Preview, rules::pylint::rules::ImportOutsideTopLevel),
|
||||
@@ -553,7 +552,6 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
||||
(Pyupgrade, "046") => (RuleGroup::Preview, rules::pyupgrade::rules::NonPEP695GenericClass),
|
||||
(Pyupgrade, "047") => (RuleGroup::Preview, rules::pyupgrade::rules::NonPEP695GenericFunction),
|
||||
(Pyupgrade, "049") => (RuleGroup::Preview, rules::pyupgrade::rules::PrivateTypeParameter),
|
||||
(Pyupgrade, "050") => (RuleGroup::Preview, rules::pyupgrade::rules::UselessClassMetaclassType),
|
||||
|
||||
// pydocstyle
|
||||
(Pydocstyle, "100") => (RuleGroup::Stable, rules::pydocstyle::rules::UndocumentedPublicModule),
|
||||
@@ -935,7 +933,6 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
||||
(Flake8UsePathlib, "207") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::Glob),
|
||||
(Flake8UsePathlib, "208") => (RuleGroup::Stable, rules::flake8_use_pathlib::violations::OsListdir),
|
||||
(Flake8UsePathlib, "210") => (RuleGroup::Stable, rules::flake8_use_pathlib::rules::InvalidPathlibWithSuffix),
|
||||
(Flake8UsePathlib, "211") => (RuleGroup::Preview, rules::flake8_use_pathlib::violations::OsSymlink),
|
||||
|
||||
// flake8-logging-format
|
||||
(Flake8LoggingFormat, "001") => (RuleGroup::Stable, rules::flake8_logging_format::violations::LoggingStringFormat),
|
||||
@@ -1157,9 +1154,3 @@ pub fn code_to_rule(linter: Linter, code: &str) -> Option<(RuleGroup, Rule)> {
|
||||
_ => return None,
|
||||
})
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Rule {
|
||||
fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
|
||||
f.write_str(self.into())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
use ruff_diagnostics::Edit;
|
||||
use ruff_python_ast::parenthesize::parenthesized_range;
|
||||
use ruff_python_ast::{self as ast, Arguments, ExceptHandler, Expr, ExprList, Parameters, Stmt};
|
||||
use ruff_python_ast::{AnyNodeRef, ArgOrKeyword};
|
||||
@@ -15,7 +16,6 @@ use ruff_python_trivia::{
|
||||
use ruff_source_file::{LineRanges, NewlineWithTrailingNewline, UniversalNewlines};
|
||||
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
|
||||
|
||||
use crate::Edit;
|
||||
use crate::Locator;
|
||||
use crate::cst::matchers::{match_function_def, match_indented_block, match_statement};
|
||||
use crate::fix::codemods;
|
||||
@@ -595,17 +595,18 @@ mod tests {
|
||||
use ruff_source_file::SourceFileBuilder;
|
||||
use test_case::test_case;
|
||||
|
||||
use ruff_diagnostics::{Diagnostic, Edit, Fix};
|
||||
use ruff_python_ast::Stmt;
|
||||
use ruff_python_codegen::Stylist;
|
||||
use ruff_python_parser::{parse_expression, parse_module};
|
||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
|
||||
use crate::Locator;
|
||||
use crate::fix::apply_fixes;
|
||||
use crate::fix::edits::{
|
||||
add_to_dunder_all, make_redundant_alias, next_stmt_break, trailing_semicolon,
|
||||
};
|
||||
use crate::message::Message;
|
||||
use crate::{Edit, Fix, Locator, OldDiagnostic};
|
||||
|
||||
/// Parse the given source using [`Mode::Module`] and return the first statement.
|
||||
fn parse_first_stmt(source: &str) -> Result<Stmt> {
|
||||
@@ -736,16 +737,24 @@ x = 1 \
|
||||
let diag = {
|
||||
use crate::rules::pycodestyle::rules::MissingNewlineAtEndOfFile;
|
||||
let mut iter = edits.into_iter();
|
||||
let diag = OldDiagnostic::new(
|
||||
let diag = Diagnostic::new(
|
||||
MissingNewlineAtEndOfFile, // The choice of rule here is arbitrary.
|
||||
TextRange::default(),
|
||||
&SourceFileBuilder::new("<filename>", "<code>").finish(),
|
||||
)
|
||||
.with_fix(Fix::safe_edits(
|
||||
iter.next().ok_or(anyhow!("expected edits nonempty"))?,
|
||||
iter,
|
||||
));
|
||||
Message::from_diagnostic(diag, None)
|
||||
Message::diagnostic(
|
||||
diag.name,
|
||||
diag.body,
|
||||
diag.suggestion,
|
||||
diag.range,
|
||||
diag.fix,
|
||||
diag.parent,
|
||||
SourceFileBuilder::new("<filename>", "<code>").finish(),
|
||||
None,
|
||||
)
|
||||
};
|
||||
assert_eq!(apply_fixes([diag].iter(), &locator).code, expect);
|
||||
Ok(())
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::collections::BTreeSet;
|
||||
use itertools::Itertools;
|
||||
use rustc_hash::{FxHashMap, FxHashSet};
|
||||
|
||||
use ruff_diagnostics::{IsolationLevel, SourceMap};
|
||||
use ruff_diagnostics::{Edit, Fix, IsolationLevel, SourceMap};
|
||||
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
|
||||
|
||||
use crate::Locator;
|
||||
@@ -11,7 +11,6 @@ use crate::linter::FixTable;
|
||||
use crate::message::Message;
|
||||
use crate::registry::Rule;
|
||||
use crate::settings::types::UnsafeFixes;
|
||||
use crate::{Edit, Fix};
|
||||
|
||||
pub(crate) mod codemods;
|
||||
pub(crate) mod edits;
|
||||
@@ -158,16 +157,14 @@ fn cmp_fix(rule1: Rule, rule2: Rule, fix1: &Fix, fix2: &Fix) -> std::cmp::Orderi
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ruff_diagnostics::SourceMarker;
|
||||
use ruff_diagnostics::{Diagnostic, Edit, Fix, SourceMarker};
|
||||
use ruff_source_file::SourceFileBuilder;
|
||||
use ruff_text_size::{Ranged, TextSize};
|
||||
|
||||
use crate::Locator;
|
||||
use crate::diagnostic::OldDiagnostic;
|
||||
use crate::fix::{FixResult, apply_fixes};
|
||||
use crate::message::Message;
|
||||
use crate::rules::pycodestyle::rules::MissingNewlineAtEndOfFile;
|
||||
use crate::{Edit, Fix};
|
||||
|
||||
fn create_diagnostics(
|
||||
filename: &str,
|
||||
@@ -177,12 +174,12 @@ mod tests {
|
||||
edit.into_iter()
|
||||
.map(|edit| {
|
||||
// The choice of rule here is arbitrary.
|
||||
let diagnostic = OldDiagnostic::new(
|
||||
MissingNewlineAtEndOfFile,
|
||||
edit.range(),
|
||||
&SourceFileBuilder::new(filename, source).finish(),
|
||||
);
|
||||
Message::from_diagnostic(diagnostic.with_fix(Fix::safe_edit(edit)), None)
|
||||
let diagnostic = Diagnostic::new(MissingNewlineAtEndOfFile, edit.range());
|
||||
Message::from_diagnostic(
|
||||
diagnostic.with_fix(Fix::safe_edit(edit)),
|
||||
SourceFileBuilder::new(filename, source).finish(),
|
||||
None,
|
||||
)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
//! Insert statements into Python code.
|
||||
use std::ops::Add;
|
||||
|
||||
use ruff_diagnostics::Edit;
|
||||
use ruff_python_ast::Stmt;
|
||||
use ruff_python_ast::helpers::is_docstring_stmt;
|
||||
use ruff_python_codegen::Stylist;
|
||||
@@ -9,7 +10,6 @@ use ruff_python_trivia::{PythonWhitespace, textwrap::indent};
|
||||
use ruff_source_file::{LineRanges, UniversalNewlineIterator};
|
||||
use ruff_text_size::{Ranged, TextSize};
|
||||
|
||||
use crate::Edit;
|
||||
use crate::Locator;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
||||
@@ -8,6 +8,7 @@ use std::error::Error;
|
||||
use anyhow::Result;
|
||||
use libcst_native::{ImportAlias, Name as cstName, NameOrAttribute};
|
||||
|
||||
use ruff_diagnostics::Edit;
|
||||
use ruff_python_ast::{self as ast, Expr, ModModule, Stmt};
|
||||
use ruff_python_codegen::Stylist;
|
||||
use ruff_python_parser::{Parsed, Tokens};
|
||||
@@ -17,7 +18,6 @@ use ruff_python_semantic::{
|
||||
use ruff_python_trivia::textwrap::indent;
|
||||
use ruff_text_size::{Ranged, TextSize};
|
||||
|
||||
use crate::Edit;
|
||||
use crate::Locator;
|
||||
use crate::cst::matchers::{match_aliases, match_import_from, match_statement};
|
||||
use crate::fix;
|
||||
|
||||
@@ -14,17 +14,12 @@ pub use rule_selector::RuleSelector;
|
||||
pub use rule_selector::clap_completion::RuleSelectorParser;
|
||||
pub use rules::pycodestyle::rules::IOError;
|
||||
|
||||
pub use diagnostic::OldDiagnostic;
|
||||
pub(crate) use ruff_diagnostics::{Applicability, Edit, Fix};
|
||||
pub use violation::{AlwaysFixableViolation, FixAvailability, Violation, ViolationMetadata};
|
||||
|
||||
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
mod checkers;
|
||||
pub mod codes;
|
||||
mod comments;
|
||||
mod cst;
|
||||
mod diagnostic;
|
||||
pub mod directives;
|
||||
mod doc_lines;
|
||||
mod docstrings;
|
||||
@@ -50,7 +45,6 @@ pub mod settings;
|
||||
pub mod source_kind;
|
||||
mod text_helpers;
|
||||
pub mod upstream_categories;
|
||||
mod violation;
|
||||
|
||||
#[cfg(any(test, fuzzing))]
|
||||
pub mod test;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use std::borrow::Cow;
|
||||
use std::cell::LazyCell;
|
||||
use std::ops::Deref;
|
||||
use std::path::Path;
|
||||
|
||||
use anyhow::{Result, anyhow};
|
||||
@@ -7,16 +9,16 @@ use itertools::Itertools;
|
||||
use ruff_python_parser::semantic_errors::SemanticSyntaxError;
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_notebook::Notebook;
|
||||
use ruff_python_ast::{ModModule, PySourceType, PythonVersion};
|
||||
use ruff_python_codegen::Stylist;
|
||||
use ruff_python_index::Indexer;
|
||||
use ruff_python_parser::{ParseError, ParseOptions, Parsed, UnsupportedSyntaxError};
|
||||
use ruff_source_file::{SourceFile, SourceFileBuilder};
|
||||
use ruff_source_file::SourceFileBuilder;
|
||||
use ruff_text_size::Ranged;
|
||||
|
||||
use crate::OldDiagnostic;
|
||||
use crate::checkers::ast::{LintContext, check_ast};
|
||||
use crate::checkers::ast::check_ast;
|
||||
use crate::checkers::filesystem::check_file_path;
|
||||
use crate::checkers::imports::check_imports;
|
||||
use crate::checkers::noqa::check_noqa;
|
||||
@@ -111,11 +113,8 @@ pub fn check_path(
|
||||
parsed: &Parsed<ModModule>,
|
||||
target_version: TargetVersion,
|
||||
) -> Vec<Message> {
|
||||
let source_file =
|
||||
SourceFileBuilder::new(path.to_string_lossy().as_ref(), locator.contents()).finish();
|
||||
|
||||
// Aggregate all diagnostics.
|
||||
let mut diagnostics = LintContext::new(&source_file);
|
||||
let mut diagnostics = vec![];
|
||||
|
||||
// Aggregate all semantic syntax errors.
|
||||
let mut semantic_syntax_errors = vec![];
|
||||
@@ -137,7 +136,7 @@ pub fn check_path(
|
||||
.iter_enabled()
|
||||
.any(|rule_code| rule_code.lint_source().is_tokens())
|
||||
{
|
||||
check_tokens(
|
||||
diagnostics.extend(check_tokens(
|
||||
tokens,
|
||||
path,
|
||||
locator,
|
||||
@@ -146,8 +145,7 @@ pub fn check_path(
|
||||
settings,
|
||||
source_type,
|
||||
source_kind.as_ipy_notebook().map(Notebook::cell_offsets),
|
||||
&mut diagnostics,
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
// Run the filesystem-based rules.
|
||||
@@ -156,15 +154,14 @@ pub fn check_path(
|
||||
.iter_enabled()
|
||||
.any(|rule_code| rule_code.lint_source().is_filesystem())
|
||||
{
|
||||
check_file_path(
|
||||
diagnostics.extend(check_file_path(
|
||||
path,
|
||||
package,
|
||||
locator,
|
||||
comment_ranges,
|
||||
settings,
|
||||
target_version.linter_version(),
|
||||
&diagnostics,
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
// Run the logical line-based rules.
|
||||
@@ -173,14 +170,9 @@ pub fn check_path(
|
||||
.iter_enabled()
|
||||
.any(|rule_code| rule_code.lint_source().is_logical_lines())
|
||||
{
|
||||
crate::checkers::logical_lines::check_logical_lines(
|
||||
tokens,
|
||||
locator,
|
||||
indexer,
|
||||
stylist,
|
||||
settings,
|
||||
&diagnostics,
|
||||
);
|
||||
diagnostics.extend(crate::checkers::logical_lines::check_logical_lines(
|
||||
tokens, locator, indexer, stylist, settings,
|
||||
));
|
||||
}
|
||||
|
||||
// Run the AST-based rules only if there are no syntax errors.
|
||||
@@ -188,7 +180,7 @@ pub fn check_path(
|
||||
let cell_offsets = source_kind.as_ipy_notebook().map(Notebook::cell_offsets);
|
||||
let notebook_index = source_kind.as_ipy_notebook().map(Notebook::index);
|
||||
|
||||
semantic_syntax_errors.extend(check_ast(
|
||||
let (new_diagnostics, new_semantic_syntax_errors) = check_ast(
|
||||
parsed,
|
||||
locator,
|
||||
stylist,
|
||||
@@ -202,8 +194,9 @@ pub fn check_path(
|
||||
cell_offsets,
|
||||
notebook_index,
|
||||
target_version,
|
||||
&diagnostics,
|
||||
));
|
||||
);
|
||||
diagnostics.extend(new_diagnostics);
|
||||
semantic_syntax_errors.extend(new_semantic_syntax_errors);
|
||||
|
||||
let use_imports = !directives.isort.skip_file
|
||||
&& settings
|
||||
@@ -212,7 +205,7 @@ pub fn check_path(
|
||||
.any(|rule_code| rule_code.lint_source().is_imports());
|
||||
if use_imports || use_doc_lines {
|
||||
if use_imports {
|
||||
check_imports(
|
||||
let import_diagnostics = check_imports(
|
||||
parsed,
|
||||
locator,
|
||||
indexer,
|
||||
@@ -223,8 +216,9 @@ pub fn check_path(
|
||||
source_type,
|
||||
cell_offsets,
|
||||
target_version.linter_version(),
|
||||
&diagnostics,
|
||||
);
|
||||
|
||||
diagnostics.extend(import_diagnostics);
|
||||
}
|
||||
if use_doc_lines {
|
||||
doc_lines.extend(doc_lines_from_ast(parsed.suite(), locator));
|
||||
@@ -244,14 +238,9 @@ pub fn check_path(
|
||||
.iter_enabled()
|
||||
.any(|rule_code| rule_code.lint_source().is_physical_lines())
|
||||
{
|
||||
check_physical_lines(
|
||||
locator,
|
||||
stylist,
|
||||
indexer,
|
||||
&doc_lines,
|
||||
settings,
|
||||
&diagnostics,
|
||||
);
|
||||
diagnostics.extend(check_physical_lines(
|
||||
locator, stylist, indexer, &doc_lines, settings,
|
||||
));
|
||||
}
|
||||
|
||||
// Raise violations for internal test rules
|
||||
@@ -261,70 +250,47 @@ pub fn check_path(
|
||||
if !settings.rules.enabled(*test_rule) {
|
||||
continue;
|
||||
}
|
||||
match test_rule {
|
||||
let diagnostic = match test_rule {
|
||||
Rule::StableTestRule => {
|
||||
test_rules::StableTestRule::diagnostic(locator, comment_ranges, &diagnostics);
|
||||
test_rules::StableTestRule::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::StableTestRuleSafeFix => {
|
||||
test_rules::StableTestRuleSafeFix::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::StableTestRuleUnsafeFix => {
|
||||
test_rules::StableTestRuleUnsafeFix::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::StableTestRuleSafeFix => test_rules::StableTestRuleSafeFix::diagnostic(
|
||||
locator,
|
||||
comment_ranges,
|
||||
&diagnostics,
|
||||
),
|
||||
Rule::StableTestRuleUnsafeFix => test_rules::StableTestRuleUnsafeFix::diagnostic(
|
||||
locator,
|
||||
comment_ranges,
|
||||
&diagnostics,
|
||||
),
|
||||
Rule::StableTestRuleDisplayOnlyFix => {
|
||||
test_rules::StableTestRuleDisplayOnlyFix::diagnostic(
|
||||
locator,
|
||||
comment_ranges,
|
||||
&diagnostics,
|
||||
);
|
||||
test_rules::StableTestRuleDisplayOnlyFix::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::PreviewTestRule => {
|
||||
test_rules::PreviewTestRule::diagnostic(locator, comment_ranges, &diagnostics);
|
||||
test_rules::PreviewTestRule::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::DeprecatedTestRule => {
|
||||
test_rules::DeprecatedTestRule::diagnostic(
|
||||
locator,
|
||||
comment_ranges,
|
||||
&diagnostics,
|
||||
);
|
||||
test_rules::DeprecatedTestRule::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::AnotherDeprecatedTestRule => {
|
||||
test_rules::AnotherDeprecatedTestRule::diagnostic(
|
||||
locator,
|
||||
comment_ranges,
|
||||
&diagnostics,
|
||||
);
|
||||
test_rules::AnotherDeprecatedTestRule::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::RemovedTestRule => {
|
||||
test_rules::RemovedTestRule::diagnostic(locator, comment_ranges, &diagnostics);
|
||||
test_rules::RemovedTestRule::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::AnotherRemovedTestRule => {
|
||||
test_rules::AnotherRemovedTestRule::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::RedirectedToTestRule => {
|
||||
test_rules::RedirectedToTestRule::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::RedirectedFromTestRule => {
|
||||
test_rules::RedirectedFromTestRule::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
Rule::AnotherRemovedTestRule => test_rules::AnotherRemovedTestRule::diagnostic(
|
||||
locator,
|
||||
comment_ranges,
|
||||
&diagnostics,
|
||||
),
|
||||
Rule::RedirectedToTestRule => test_rules::RedirectedToTestRule::diagnostic(
|
||||
locator,
|
||||
comment_ranges,
|
||||
&diagnostics,
|
||||
),
|
||||
Rule::RedirectedFromTestRule => test_rules::RedirectedFromTestRule::diagnostic(
|
||||
locator,
|
||||
comment_ranges,
|
||||
&diagnostics,
|
||||
),
|
||||
Rule::RedirectedFromPrefixTestRule => {
|
||||
test_rules::RedirectedFromPrefixTestRule::diagnostic(
|
||||
locator,
|
||||
comment_ranges,
|
||||
&diagnostics,
|
||||
);
|
||||
test_rules::RedirectedFromPrefixTestRule::diagnostic(locator, comment_ranges)
|
||||
}
|
||||
_ => unreachable!("All test rules must have an implementation"),
|
||||
};
|
||||
if let Some(diagnostic) = diagnostic {
|
||||
diagnostics.push(diagnostic);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -342,9 +308,7 @@ pub fn check_path(
|
||||
RuleSet::empty()
|
||||
};
|
||||
if !per_file_ignores.is_empty() {
|
||||
diagnostics
|
||||
.as_mut_vec()
|
||||
.retain(|diagnostic| !per_file_ignores.contains(diagnostic.rule()));
|
||||
diagnostics.retain(|diagnostic| !per_file_ignores.contains(diagnostic.rule()));
|
||||
}
|
||||
|
||||
// Enforce `noqa` directives.
|
||||
@@ -366,13 +330,11 @@ pub fn check_path(
|
||||
);
|
||||
if noqa.is_enabled() {
|
||||
for index in ignored.iter().rev() {
|
||||
diagnostics.as_mut_vec().swap_remove(*index);
|
||||
diagnostics.swap_remove(*index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let mut diagnostics = diagnostics.into_diagnostics();
|
||||
|
||||
if parsed.has_valid_syntax() {
|
||||
// Remove fixes for any rules marked as unfixable.
|
||||
for diagnostic in &mut diagnostics {
|
||||
@@ -410,9 +372,9 @@ pub fn check_path(
|
||||
parsed.errors(),
|
||||
syntax_errors,
|
||||
&semantic_syntax_errors,
|
||||
path,
|
||||
locator,
|
||||
directives,
|
||||
&source_file,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -476,7 +438,7 @@ pub fn add_noqa_to_path(
|
||||
)
|
||||
}
|
||||
|
||||
/// Generate a [`Message`] for each [`OldDiagnostic`] triggered by the given source
|
||||
/// Generate a [`Message`] for each [`Diagnostic`] triggered by the given source
|
||||
/// code.
|
||||
pub fn lint_only(
|
||||
path: &Path,
|
||||
@@ -541,28 +503,39 @@ pub fn lint_only(
|
||||
|
||||
/// Convert from diagnostics to messages.
|
||||
fn diagnostics_to_messages(
|
||||
diagnostics: Vec<OldDiagnostic>,
|
||||
diagnostics: Vec<Diagnostic>,
|
||||
parse_errors: &[ParseError],
|
||||
unsupported_syntax_errors: &[UnsupportedSyntaxError],
|
||||
semantic_syntax_errors: &[SemanticSyntaxError],
|
||||
path: &Path,
|
||||
locator: &Locator,
|
||||
directives: &Directives,
|
||||
source_file: &SourceFile,
|
||||
) -> Vec<Message> {
|
||||
let file = LazyCell::new(|| {
|
||||
let mut builder =
|
||||
SourceFileBuilder::new(path.to_string_lossy().as_ref(), locator.contents());
|
||||
|
||||
if let Some(line_index) = locator.line_index() {
|
||||
builder.set_line_index(line_index.clone());
|
||||
}
|
||||
|
||||
builder.finish()
|
||||
});
|
||||
|
||||
parse_errors
|
||||
.iter()
|
||||
.map(|parse_error| Message::from_parse_error(parse_error, locator, source_file.clone()))
|
||||
.map(|parse_error| Message::from_parse_error(parse_error, locator, file.deref().clone()))
|
||||
.chain(unsupported_syntax_errors.iter().map(|syntax_error| {
|
||||
Message::from_unsupported_syntax_error(syntax_error, source_file.clone())
|
||||
Message::from_unsupported_syntax_error(syntax_error, file.deref().clone())
|
||||
}))
|
||||
.chain(
|
||||
semantic_syntax_errors
|
||||
.iter()
|
||||
.map(|error| Message::from_semantic_syntax_error(error, source_file.clone())),
|
||||
.map(|error| Message::from_semantic_syntax_error(error, file.deref().clone())),
|
||||
)
|
||||
.chain(diagnostics.into_iter().map(|diagnostic| {
|
||||
let noqa_offset = directives.noqa_line_for.resolve(diagnostic.start());
|
||||
Message::from_diagnostic(diagnostic, Some(noqa_offset))
|
||||
Message::from_diagnostic(diagnostic, file.deref().clone(), Some(noqa_offset))
|
||||
}))
|
||||
.collect()
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ use colored::{Color, ColoredString, Colorize, Styles};
|
||||
use ruff_text_size::{Ranged, TextRange, TextSize};
|
||||
use similar::{ChangeTag, TextDiff};
|
||||
|
||||
use ruff_diagnostics::{Applicability, Fix};
|
||||
use ruff_source_file::{OneIndexed, SourceFile};
|
||||
|
||||
use crate::message::Message;
|
||||
use crate::text_helpers::ShowNonprinting;
|
||||
use crate::{Applicability, Fix};
|
||||
|
||||
/// Renders a diff that shows the code fixes.
|
||||
///
|
||||
|
||||
@@ -4,11 +4,11 @@ use serde::ser::SerializeSeq;
|
||||
use serde::{Serialize, Serializer};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use ruff_diagnostics::Edit;
|
||||
use ruff_notebook::NotebookIndex;
|
||||
use ruff_source_file::{LineColumn, OneIndexed, SourceCode};
|
||||
use ruff_text_size::Ranged;
|
||||
|
||||
use crate::Edit;
|
||||
use crate::message::{Emitter, EmitterContext, Message};
|
||||
|
||||
#[derive(Default)]
|
||||
|
||||
@@ -16,6 +16,7 @@ pub use json_lines::JsonLinesEmitter;
|
||||
pub use junit::JunitEmitter;
|
||||
pub use pylint::PylintEmitter;
|
||||
pub use rdjson::RdjsonEmitter;
|
||||
use ruff_diagnostics::{Diagnostic, Fix};
|
||||
use ruff_notebook::NotebookIndex;
|
||||
use ruff_python_parser::{ParseError, UnsupportedSyntaxError};
|
||||
use ruff_source_file::{LineColumn, SourceFile};
|
||||
@@ -27,7 +28,6 @@ use crate::Locator;
|
||||
use crate::codes::NoqaCode;
|
||||
use crate::logging::DisplayParseErrorType;
|
||||
use crate::registry::Rule;
|
||||
use crate::{Fix, OldDiagnostic};
|
||||
|
||||
mod azure;
|
||||
mod diff;
|
||||
@@ -50,7 +50,7 @@ mod text;
|
||||
/// `noqa` offsets.
|
||||
///
|
||||
/// For diagnostic messages, the [`db::Diagnostic`]'s primary message contains the
|
||||
/// [`OldDiagnostic::body`], and the primary annotation optionally contains the suggestion accompanying
|
||||
/// [`Diagnostic::body`], and the primary annotation optionally contains the suggestion accompanying
|
||||
/// a fix. The `db::Diagnostic::id` field contains the kebab-case lint name derived from the `Rule`.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct Message {
|
||||
@@ -60,7 +60,6 @@ pub struct Message {
|
||||
pub fix: Option<Fix>,
|
||||
pub parent: Option<TextSize>,
|
||||
pub(crate) noqa_offset: Option<TextSize>,
|
||||
noqa_code: Option<NoqaCode>,
|
||||
}
|
||||
|
||||
impl Message {
|
||||
@@ -77,12 +76,12 @@ impl Message {
|
||||
fix: None,
|
||||
parent: None,
|
||||
noqa_offset: None,
|
||||
noqa_code: None,
|
||||
}
|
||||
}
|
||||
|
||||
#[expect(clippy::too_many_arguments)]
|
||||
pub fn diagnostic(
|
||||
name: &'static str,
|
||||
body: String,
|
||||
suggestion: Option<String>,
|
||||
range: TextRange,
|
||||
@@ -90,10 +89,9 @@ impl Message {
|
||||
parent: Option<TextSize>,
|
||||
file: SourceFile,
|
||||
noqa_offset: Option<TextSize>,
|
||||
rule: Rule,
|
||||
) -> Message {
|
||||
let mut diagnostic = db::Diagnostic::new(
|
||||
DiagnosticId::Lint(LintName::of(rule.into())),
|
||||
DiagnosticId::Lint(LintName::of(name)),
|
||||
Severity::Error,
|
||||
body,
|
||||
);
|
||||
@@ -109,22 +107,25 @@ impl Message {
|
||||
fix,
|
||||
parent,
|
||||
noqa_offset,
|
||||
noqa_code: Some(rule.noqa_code()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a [`Message`] from the given [`OldDiagnostic`] corresponding to a rule violation.
|
||||
pub fn from_diagnostic(diagnostic: OldDiagnostic, noqa_offset: Option<TextSize>) -> Message {
|
||||
let OldDiagnostic {
|
||||
/// Create a [`Message`] from the given [`Diagnostic`] corresponding to a rule violation.
|
||||
pub fn from_diagnostic(
|
||||
diagnostic: Diagnostic,
|
||||
file: SourceFile,
|
||||
noqa_offset: Option<TextSize>,
|
||||
) -> Message {
|
||||
let Diagnostic {
|
||||
name,
|
||||
body,
|
||||
suggestion,
|
||||
range,
|
||||
fix,
|
||||
parent,
|
||||
rule,
|
||||
file,
|
||||
} = diagnostic;
|
||||
Self::diagnostic(
|
||||
name,
|
||||
body,
|
||||
suggestion,
|
||||
range,
|
||||
@@ -132,7 +133,6 @@ impl Message {
|
||||
parent,
|
||||
file,
|
||||
noqa_offset,
|
||||
rule,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ impl Message {
|
||||
|
||||
/// Returns the [`NoqaCode`] corresponding to the diagnostic message.
|
||||
pub fn to_noqa_code(&self) -> Option<NoqaCode> {
|
||||
self.noqa_code
|
||||
self.to_rule().map(|rule| rule.noqa_code())
|
||||
}
|
||||
|
||||
/// Returns the URL for the rule documentation, if it exists.
|
||||
@@ -371,8 +371,7 @@ impl<'a> EmitterContext<'a> {
|
||||
mod tests {
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
use crate::codes::Rule;
|
||||
use crate::{Edit, Fix};
|
||||
use ruff_diagnostics::{Edit, Fix};
|
||||
use ruff_notebook::NotebookIndex;
|
||||
use ruff_python_parser::{Mode, ParseOptions, parse_unchecked};
|
||||
use ruff_source_file::{OneIndexed, SourceFileBuilder};
|
||||
@@ -418,6 +417,7 @@ def fibonacci(n):
|
||||
|
||||
let unused_import_start = TextSize::from(7);
|
||||
let unused_import = Message::diagnostic(
|
||||
"unused-import",
|
||||
"`os` imported but unused".to_string(),
|
||||
Some("Remove unused import: `os`".to_string()),
|
||||
TextRange::new(unused_import_start, TextSize::from(9)),
|
||||
@@ -428,11 +428,11 @@ def fibonacci(n):
|
||||
None,
|
||||
fib_source.clone(),
|
||||
Some(unused_import_start),
|
||||
Rule::UnusedImport,
|
||||
);
|
||||
|
||||
let unused_variable_start = TextSize::from(94);
|
||||
let unused_variable = Message::diagnostic(
|
||||
"unused-variable",
|
||||
"Local variable `x` is assigned to but never used".to_string(),
|
||||
Some("Remove assignment to unused variable `x`".to_string()),
|
||||
TextRange::new(unused_variable_start, TextSize::from(95)),
|
||||
@@ -443,13 +443,13 @@ def fibonacci(n):
|
||||
None,
|
||||
fib_source,
|
||||
Some(unused_variable_start),
|
||||
Rule::UnusedVariable,
|
||||
);
|
||||
|
||||
let file_2 = r"if a == 1: pass";
|
||||
|
||||
let undefined_name_start = TextSize::from(3);
|
||||
let undefined_name = Message::diagnostic(
|
||||
"undefined-name",
|
||||
"Undefined name `a`".to_string(),
|
||||
None,
|
||||
TextRange::new(undefined_name_start, TextSize::from(4)),
|
||||
@@ -457,7 +457,6 @@ def fibonacci(n):
|
||||
None,
|
||||
SourceFileBuilder::new("undef.py", file_2).finish(),
|
||||
Some(undefined_name_start),
|
||||
Rule::UndefinedName,
|
||||
);
|
||||
|
||||
vec![unused_import, unused_variable, undefined_name]
|
||||
@@ -480,6 +479,7 @@ def foo():
|
||||
|
||||
let unused_import_os_start = TextSize::from(16);
|
||||
let unused_import_os = Message::diagnostic(
|
||||
"unused-import",
|
||||
"`os` imported but unused".to_string(),
|
||||
Some("Remove unused import: `os`".to_string()),
|
||||
TextRange::new(unused_import_os_start, TextSize::from(18)),
|
||||
@@ -490,11 +490,11 @@ def foo():
|
||||
None,
|
||||
notebook_source.clone(),
|
||||
Some(unused_import_os_start),
|
||||
Rule::UnusedImport,
|
||||
);
|
||||
|
||||
let unused_import_math_start = TextSize::from(35);
|
||||
let unused_import_math = Message::diagnostic(
|
||||
"unused-import",
|
||||
"`math` imported but unused".to_string(),
|
||||
Some("Remove unused import: `math`".to_string()),
|
||||
TextRange::new(unused_import_math_start, TextSize::from(39)),
|
||||
@@ -505,11 +505,11 @@ def foo():
|
||||
None,
|
||||
notebook_source.clone(),
|
||||
Some(unused_import_math_start),
|
||||
Rule::UnusedImport,
|
||||
);
|
||||
|
||||
let unused_variable_start = TextSize::from(98);
|
||||
let unused_variable = Message::diagnostic(
|
||||
"unused-variable",
|
||||
"Local variable `x` is assigned to but never used".to_string(),
|
||||
Some("Remove assignment to unused variable `x`".to_string()),
|
||||
TextRange::new(unused_variable_start, TextSize::from(99)),
|
||||
@@ -520,7 +520,6 @@ def foo():
|
||||
None,
|
||||
notebook_source,
|
||||
Some(unused_variable_start),
|
||||
Rule::UnusedVariable,
|
||||
);
|
||||
|
||||
let mut notebook_indexes = FxHashMap::default();
|
||||
|
||||
@@ -4,10 +4,10 @@ use serde::ser::SerializeSeq;
|
||||
use serde::{Serialize, Serializer};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use ruff_diagnostics::Edit;
|
||||
use ruff_source_file::SourceCode;
|
||||
use ruff_text_size::Ranged;
|
||||
|
||||
use crate::Edit;
|
||||
use crate::message::{Emitter, EmitterContext, LineColumn, Message};
|
||||
|
||||
#[derive(Default)]
|
||||
|
||||
@@ -9,11 +9,11 @@ use anyhow::Result;
|
||||
use itertools::Itertools;
|
||||
use log::warn;
|
||||
|
||||
use ruff_diagnostics::Edit;
|
||||
use ruff_python_trivia::{CommentRanges, Cursor, indentation_at_offset};
|
||||
use ruff_source_file::{LineEnding, LineRanges};
|
||||
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
|
||||
|
||||
use crate::Edit;
|
||||
use crate::Locator;
|
||||
use crate::codes::NoqaCode;
|
||||
use crate::fs::relativize_path;
|
||||
@@ -1221,6 +1221,7 @@ mod tests {
|
||||
|
||||
use insta::assert_debug_snapshot;
|
||||
|
||||
use ruff_diagnostics::{Diagnostic, Edit};
|
||||
use ruff_python_trivia::CommentRanges;
|
||||
use ruff_source_file::{LineEnding, SourceFileBuilder};
|
||||
use ruff_text_size::{Ranged, TextLen, TextRange, TextSize};
|
||||
@@ -1233,7 +1234,6 @@ mod tests {
|
||||
use crate::rules::pycodestyle::rules::{AmbiguousVariableName, UselessSemicolon};
|
||||
use crate::rules::pyflakes::rules::UnusedVariable;
|
||||
use crate::rules::pyupgrade::rules::PrintfStringFormatting;
|
||||
use crate::{Edit, OldDiagnostic};
|
||||
use crate::{Locator, generate_noqa_edits};
|
||||
|
||||
fn assert_lexed_ranges_match_slices(
|
||||
@@ -1252,9 +1252,14 @@ mod tests {
|
||||
}
|
||||
|
||||
/// Create a [`Message`] with a placeholder filename and rule code from `diagnostic`.
|
||||
fn message_from_diagnostic(diagnostic: OldDiagnostic) -> Message {
|
||||
fn message_from_diagnostic(
|
||||
diagnostic: Diagnostic,
|
||||
path: impl AsRef<Path>,
|
||||
source: &str,
|
||||
) -> Message {
|
||||
let noqa_offset = diagnostic.start();
|
||||
Message::from_diagnostic(diagnostic, Some(noqa_offset))
|
||||
let file = SourceFileBuilder::new(path.as_ref().to_string_lossy(), source).finish();
|
||||
Message::from_diagnostic(diagnostic, file, Some(noqa_offset))
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2837,15 +2842,13 @@ mod tests {
|
||||
assert_eq!(count, 0);
|
||||
assert_eq!(output, format!("{contents}"));
|
||||
|
||||
let source_file = SourceFileBuilder::new(path.to_string_lossy(), contents).finish();
|
||||
let messages = [OldDiagnostic::new(
|
||||
let messages = [Diagnostic::new(
|
||||
UnusedVariable {
|
||||
name: "x".to_string(),
|
||||
},
|
||||
TextRange::new(TextSize::from(0), TextSize::from(0)),
|
||||
&source_file,
|
||||
)]
|
||||
.map(message_from_diagnostic);
|
||||
.map(|d| message_from_diagnostic(d, path, contents));
|
||||
|
||||
let contents = "x = 1";
|
||||
let noqa_line_for = NoqaMapping::default();
|
||||
@@ -2861,22 +2864,19 @@ mod tests {
|
||||
assert_eq!(count, 1);
|
||||
assert_eq!(output, "x = 1 # noqa: F841\n");
|
||||
|
||||
let source_file = SourceFileBuilder::new(path.to_string_lossy(), contents).finish();
|
||||
let messages = [
|
||||
OldDiagnostic::new(
|
||||
Diagnostic::new(
|
||||
AmbiguousVariableName("x".to_string()),
|
||||
TextRange::new(TextSize::from(0), TextSize::from(0)),
|
||||
&source_file,
|
||||
),
|
||||
OldDiagnostic::new(
|
||||
Diagnostic::new(
|
||||
UnusedVariable {
|
||||
name: "x".to_string(),
|
||||
},
|
||||
TextRange::new(TextSize::from(0), TextSize::from(0)),
|
||||
&source_file,
|
||||
),
|
||||
]
|
||||
.map(message_from_diagnostic);
|
||||
.map(|d| message_from_diagnostic(d, path, contents));
|
||||
let contents = "x = 1 # noqa: E741\n";
|
||||
let noqa_line_for = NoqaMapping::default();
|
||||
let comment_ranges =
|
||||
@@ -2893,22 +2893,19 @@ mod tests {
|
||||
assert_eq!(count, 1);
|
||||
assert_eq!(output, "x = 1 # noqa: E741, F841\n");
|
||||
|
||||
let source_file = SourceFileBuilder::new(path.to_string_lossy(), contents).finish();
|
||||
let messages = [
|
||||
OldDiagnostic::new(
|
||||
Diagnostic::new(
|
||||
AmbiguousVariableName("x".to_string()),
|
||||
TextRange::new(TextSize::from(0), TextSize::from(0)),
|
||||
&source_file,
|
||||
),
|
||||
OldDiagnostic::new(
|
||||
Diagnostic::new(
|
||||
UnusedVariable {
|
||||
name: "x".to_string(),
|
||||
},
|
||||
TextRange::new(TextSize::from(0), TextSize::from(0)),
|
||||
&source_file,
|
||||
),
|
||||
]
|
||||
.map(message_from_diagnostic);
|
||||
.map(|d| message_from_diagnostic(d, path, contents));
|
||||
let contents = "x = 1 # noqa";
|
||||
let noqa_line_for = NoqaMapping::default();
|
||||
let comment_ranges =
|
||||
@@ -2939,13 +2936,11 @@ print(
|
||||
)
|
||||
"#;
|
||||
let noqa_line_for = [TextRange::new(8.into(), 68.into())].into_iter().collect();
|
||||
let source_file = SourceFileBuilder::new(path.to_string_lossy(), source).finish();
|
||||
let messages = [OldDiagnostic::new(
|
||||
let messages = [Diagnostic::new(
|
||||
PrintfStringFormatting,
|
||||
TextRange::new(12.into(), 79.into()),
|
||||
&source_file,
|
||||
)]
|
||||
.map(message_from_diagnostic);
|
||||
.map(|d| message_from_diagnostic(d, path, source));
|
||||
let comment_ranges = CommentRanges::default();
|
||||
let edits = generate_noqa_edits(
|
||||
path,
|
||||
@@ -2973,13 +2968,11 @@ print(
|
||||
foo;
|
||||
bar =
|
||||
";
|
||||
let source_file = SourceFileBuilder::new(path.to_string_lossy(), source).finish();
|
||||
let messages = [OldDiagnostic::new(
|
||||
let messages = [Diagnostic::new(
|
||||
UselessSemicolon,
|
||||
TextRange::new(4.into(), 5.into()),
|
||||
&source_file,
|
||||
)]
|
||||
.map(message_from_diagnostic);
|
||||
.map(|d| message_from_diagnostic(d, path, source));
|
||||
let noqa_line_for = NoqaMapping::default();
|
||||
let comment_ranges = CommentRanges::default();
|
||||
let edits = generate_noqa_edits(
|
||||
|
||||
@@ -3,16 +3,16 @@ use log::warn;
|
||||
use pyproject_toml::PyProjectToml;
|
||||
use ruff_text_size::{TextRange, TextSize};
|
||||
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_source_file::SourceFile;
|
||||
|
||||
use crate::IOError;
|
||||
use crate::OldDiagnostic;
|
||||
use crate::message::Message;
|
||||
use crate::registry::Rule;
|
||||
use crate::rules::ruff::rules::InvalidPyprojectToml;
|
||||
use crate::settings::LinterSettings;
|
||||
|
||||
pub fn lint_pyproject_toml(source_file: &SourceFile, settings: &LinterSettings) -> Vec<Message> {
|
||||
pub fn lint_pyproject_toml(source_file: SourceFile, settings: &LinterSettings) -> Vec<Message> {
|
||||
let Some(err) = toml::from_str::<PyProjectToml>(source_file.source_text()).err() else {
|
||||
return Vec::default();
|
||||
};
|
||||
@@ -29,9 +29,8 @@ pub fn lint_pyproject_toml(source_file: &SourceFile, settings: &LinterSettings)
|
||||
source_file.name(),
|
||||
);
|
||||
if settings.rules.enabled(Rule::IOError) {
|
||||
let diagnostic =
|
||||
OldDiagnostic::new(IOError { message }, TextRange::default(), source_file);
|
||||
messages.push(Message::from_diagnostic(diagnostic, None));
|
||||
let diagnostic = Diagnostic::new(IOError { message }, TextRange::default());
|
||||
messages.push(Message::from_diagnostic(diagnostic, source_file, None));
|
||||
} else {
|
||||
warn!(
|
||||
"{}{}{} {message}",
|
||||
@@ -52,12 +51,8 @@ pub fn lint_pyproject_toml(source_file: &SourceFile, settings: &LinterSettings)
|
||||
|
||||
if settings.rules.enabled(Rule::InvalidPyprojectToml) {
|
||||
let toml_err = err.message().to_string();
|
||||
let diagnostic = OldDiagnostic::new(
|
||||
InvalidPyprojectToml { message: toml_err },
|
||||
range,
|
||||
source_file,
|
||||
);
|
||||
messages.push(Message::from_diagnostic(diagnostic, None));
|
||||
let diagnostic = Diagnostic::new(InvalidPyprojectToml { message: toml_err }, range);
|
||||
messages.push(Message::from_diagnostic(diagnostic, source_file, None));
|
||||
}
|
||||
|
||||
messages
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
use anyhow::{Result, anyhow};
|
||||
use itertools::Itertools;
|
||||
|
||||
use ruff_diagnostics::Edit;
|
||||
use ruff_python_ast as ast;
|
||||
use ruff_python_codegen::Stylist;
|
||||
use ruff_python_semantic::{Binding, BindingKind, Scope, ScopeId, SemanticModel};
|
||||
use ruff_python_stdlib::{builtins::is_python_builtin, keyword::is_keyword};
|
||||
use ruff_text_size::Ranged;
|
||||
|
||||
use crate::Edit;
|
||||
use crate::checkers::ast::Checker;
|
||||
|
||||
pub(crate) struct Renamer;
|
||||
|
||||
@@ -1,17 +1,10 @@
|
||||
use crate::checkers::ast::Checker;
|
||||
use crate::fix::edits::remove_unused_imports;
|
||||
use crate::importer::ImportRequest;
|
||||
use crate::rules::numpy::helpers::{AttributeSearcher, ImportSearcher};
|
||||
use ruff_diagnostics::{Edit, Fix};
|
||||
use ruff_python_ast::name::QualifiedNameBuilder;
|
||||
use ruff_python_ast::statement_visitor::StatementVisitor;
|
||||
use ruff_python_ast::visitor::Visitor;
|
||||
use ruff_python_ast::{Expr, ExprAttribute, ExprName, StmtTry};
|
||||
use ruff_python_ast::{Expr, ExprName, StmtTry};
|
||||
use ruff_python_semantic::Exceptions;
|
||||
use ruff_python_semantic::SemanticModel;
|
||||
use ruff_python_semantic::{MemberNameImport, NameImport};
|
||||
use ruff_text_size::Ranged;
|
||||
use ruff_text_size::TextRange;
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub(crate) enum Replacement {
|
||||
@@ -177,70 +170,3 @@ pub(crate) fn is_airflow_builtin_or_provider(
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the [`ast::ExprName`] at the head of the expression, if any.
|
||||
pub(crate) fn match_head(value: &Expr) -> Option<&ExprName> {
|
||||
match value {
|
||||
Expr::Attribute(ExprAttribute { value, .. }) => value.as_name_expr(),
|
||||
Expr::Name(name) => Some(name),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the [`Fix`] that imports the new name and updates where the import is referenced.
|
||||
/// This is used for cases that member name has changed.
|
||||
/// (e.g., `airflow.datasts.Dataset` to `airflow.sdk.Asset`)
|
||||
pub(crate) fn generate_import_edit(
|
||||
expr: &Expr,
|
||||
checker: &Checker,
|
||||
module: &str,
|
||||
name: &str,
|
||||
ranged: TextRange,
|
||||
) -> Option<Fix> {
|
||||
let (import_edit, _) = checker
|
||||
.importer()
|
||||
.get_or_import_symbol(
|
||||
&ImportRequest::import_from(module, name),
|
||||
expr.start(),
|
||||
checker.semantic(),
|
||||
)
|
||||
.ok()?;
|
||||
let replacement_edit = Edit::range_replacement(name.to_string(), ranged.range());
|
||||
Some(Fix::safe_edits(import_edit, [replacement_edit]))
|
||||
}
|
||||
|
||||
/// Return the [`Fix`] that remove the original import and import the same name with new path.
|
||||
/// This is used for cases that member name has not changed.
|
||||
/// (e.g., `airflow.operators.pig_operator.PigOperator` to `airflow.providers.apache.pig.hooks.pig.PigCliHook`)
|
||||
pub(crate) fn generate_remove_and_runtime_import_edit(
|
||||
expr: &Expr,
|
||||
checker: &Checker,
|
||||
module: &str,
|
||||
name: &str,
|
||||
) -> Option<Fix> {
|
||||
let head = match_head(expr)?;
|
||||
let semantic = checker.semantic();
|
||||
let binding = semantic
|
||||
.resolve_name(head)
|
||||
.or_else(|| checker.semantic().lookup_symbol(&head.id))
|
||||
.map(|id| checker.semantic().binding(id))?;
|
||||
let stmt = binding.statement(semantic)?;
|
||||
let remove_edit = remove_unused_imports(
|
||||
std::iter::once(name),
|
||||
stmt,
|
||||
None,
|
||||
checker.locator(),
|
||||
checker.stylist(),
|
||||
checker.indexer(),
|
||||
)
|
||||
.ok()?;
|
||||
let import_edit = checker.importer().add_import(
|
||||
&NameImport::ImportFrom(MemberNameImport::member(
|
||||
(*module).to_string(),
|
||||
name.to_string(),
|
||||
)),
|
||||
expr.start(),
|
||||
);
|
||||
|
||||
Some(Fix::unsafe_edits(remove_edit, [import_edit]))
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use ruff_diagnostics::{Diagnostic, Violation};
|
||||
use ruff_macros::{ViolationMetadata, derive_message_formats};
|
||||
use ruff_python_ast::Expr;
|
||||
use ruff_python_ast::{self as ast};
|
||||
use ruff_python_semantic::Modules;
|
||||
use ruff_text_size::Ranged;
|
||||
|
||||
use crate::Violation;
|
||||
use crate::checkers::ast::Checker;
|
||||
|
||||
/// ## What it does
|
||||
@@ -86,5 +86,6 @@ pub(crate) fn dag_no_schedule_argument(checker: &Checker, expr: &Expr) {
|
||||
}
|
||||
|
||||
// Produce a diagnostic when the `schedule` keyword argument is not found.
|
||||
checker.report_diagnostic(AirflowDagNoScheduleArgument, expr.range());
|
||||
let diagnostic = Diagnostic::new(AirflowDagNoScheduleArgument, expr.range());
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
use crate::checkers::ast::Checker;
|
||||
use crate::rules::airflow::helpers::{
|
||||
ProviderReplacement, generate_import_edit, generate_remove_and_runtime_import_edit,
|
||||
is_guarded_by_try_except,
|
||||
};
|
||||
use crate::importer::ImportRequest;
|
||||
use crate::rules::airflow::helpers::{ProviderReplacement, is_guarded_by_try_except};
|
||||
use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation};
|
||||
use ruff_macros::{ViolationMetadata, derive_message_formats};
|
||||
use ruff_python_ast::name::QualifiedName;
|
||||
use ruff_python_ast::{Expr, ExprAttribute};
|
||||
use ruff_python_semantic::Modules;
|
||||
use ruff_text_size::Ranged;
|
||||
use ruff_text_size::TextRange;
|
||||
|
||||
use crate::{FixAvailability, Violation};
|
||||
use crate::checkers::ast::Checker;
|
||||
|
||||
/// ## What it does
|
||||
/// Checks for uses of Airflow functions and values that have been moved to it providers.
|
||||
@@ -31,12 +28,12 @@ use crate::{FixAvailability, Violation};
|
||||
/// from airflow.providers.fab.auth_manager.fab_auth_manage import FabAuthManager
|
||||
/// ```
|
||||
#[derive(ViolationMetadata)]
|
||||
pub(crate) struct Airflow3MovedToProvider<'a> {
|
||||
deprecated: QualifiedName<'a>,
|
||||
pub(crate) struct Airflow3MovedToProvider {
|
||||
deprecated: String,
|
||||
replacement: ProviderReplacement,
|
||||
}
|
||||
|
||||
impl Violation for Airflow3MovedToProvider<'_> {
|
||||
impl Violation for Airflow3MovedToProvider {
|
||||
const FIX_AVAILABILITY: FixAvailability = FixAvailability::Sometimes;
|
||||
|
||||
#[derive_message_formats]
|
||||
@@ -1171,7 +1168,7 @@ fn check_names_moved_to_provider(checker: &Checker, expr: &Expr, ranged: TextRan
|
||||
[
|
||||
"airflow",
|
||||
"sensors",
|
||||
"external_task" | "external_task_sensor",
|
||||
"external_task",
|
||||
"ExternalTaskSensorLink",
|
||||
] => ProviderReplacement::AutoImport {
|
||||
module: "airflow.providers.standard.sensors.external_task",
|
||||
@@ -1183,7 +1180,7 @@ fn check_names_moved_to_provider(checker: &Checker, expr: &Expr, ranged: TextRan
|
||||
"airflow",
|
||||
"sensors",
|
||||
"external_task_sensor",
|
||||
rest @ ("ExternalTaskMarker" | "ExternalTaskSensor"),
|
||||
rest @ ("ExternalTaskMarker" | "ExternalTaskSensor" | "ExternalTaskSensorLink"),
|
||||
] => ProviderReplacement::SourceModuleMovedToProvider {
|
||||
module: "airflow.providers.standard.sensors.external_task",
|
||||
name: (*rest).to_string(),
|
||||
@@ -1200,38 +1197,34 @@ fn check_names_moved_to_provider(checker: &Checker, expr: &Expr, ranged: TextRan
|
||||
_ => return,
|
||||
};
|
||||
|
||||
let (module, name) = match &replacement {
|
||||
ProviderReplacement::AutoImport { module, name, .. } => (module, *name),
|
||||
ProviderReplacement::SourceModuleMovedToProvider { module, name, .. } => {
|
||||
(module, name.as_str())
|
||||
}
|
||||
ProviderReplacement::None => {
|
||||
checker.report_diagnostic(
|
||||
Airflow3MovedToProvider {
|
||||
deprecated: qualified_name,
|
||||
replacement,
|
||||
},
|
||||
ranged,
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if is_guarded_by_try_except(expr, module, name, checker.semantic()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let mut diagnostic = checker.report_diagnostic(
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
Airflow3MovedToProvider {
|
||||
deprecated: qualified_name,
|
||||
deprecated: qualified_name.to_string(),
|
||||
replacement: replacement.clone(),
|
||||
},
|
||||
ranged,
|
||||
ranged.range(),
|
||||
);
|
||||
|
||||
if let Some(fix) = generate_import_edit(expr, checker, module, name, ranged)
|
||||
.or_else(|| generate_remove_and_runtime_import_edit(expr, checker, module, name))
|
||||
{
|
||||
diagnostic.set_fix(fix);
|
||||
let semantic = checker.semantic();
|
||||
if let Some((module, name)) = match &replacement {
|
||||
ProviderReplacement::AutoImport { module, name, .. } => Some((module, *name)),
|
||||
ProviderReplacement::SourceModuleMovedToProvider { module, name, .. } => {
|
||||
Some((module, name.as_str()))
|
||||
}
|
||||
ProviderReplacement::None => None,
|
||||
} {
|
||||
if is_guarded_by_try_except(expr, module, name, semantic) {
|
||||
return;
|
||||
}
|
||||
diagnostic.try_set_fix(|| {
|
||||
let (import_edit, binding) = checker.importer().get_or_import_symbol(
|
||||
&ImportRequest::import_from(module, name),
|
||||
expr.start(),
|
||||
checker.semantic(),
|
||||
)?;
|
||||
let replacement_edit = Edit::range_replacement(binding, ranged.range());
|
||||
Ok(Fix::safe_edits(import_edit, [replacement_edit]))
|
||||
});
|
||||
}
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::checkers::ast::Checker;
|
||||
use crate::importer::ImportRequest;
|
||||
use crate::rules::airflow::helpers::{
|
||||
Replacement, generate_import_edit, generate_remove_and_runtime_import_edit,
|
||||
is_airflow_builtin_or_provider, is_guarded_by_try_except,
|
||||
Replacement, is_airflow_builtin_or_provider, is_guarded_by_try_except,
|
||||
};
|
||||
use crate::{Edit, Fix, FixAvailability, Violation};
|
||||
use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation};
|
||||
use ruff_macros::{ViolationMetadata, derive_message_formats};
|
||||
use ruff_python_ast::helpers::map_callable;
|
||||
use ruff_python_ast::{
|
||||
@@ -166,13 +166,13 @@ fn check_function_parameters(checker: &Checker, function_def: &StmtFunctionDef)
|
||||
for param in function_def.parameters.iter_non_variadic_params() {
|
||||
let param_name = param.name();
|
||||
if REMOVED_CONTEXT_KEYS.contains(¶m_name.as_str()) {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
Airflow3Removal {
|
||||
deprecated: param_name.to_string(),
|
||||
replacement: Replacement::None,
|
||||
},
|
||||
param_name.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ fn check_call_arguments(checker: &Checker, qualified_name: &QualifiedName, argum
|
||||
segments => {
|
||||
if is_airflow_auth_manager(segments) {
|
||||
if !arguments.is_empty() {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
Airflow3Removal {
|
||||
deprecated: String::from("appbuilder"),
|
||||
replacement: Replacement::Message(
|
||||
@@ -208,7 +208,7 @@ fn check_call_arguments(checker: &Checker, qualified_name: &QualifiedName, argum
|
||||
),
|
||||
},
|
||||
arguments.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
} else if is_airflow_task_handler(segments) {
|
||||
diagnostic_for_argument(checker, arguments, "filename_template", None);
|
||||
@@ -305,7 +305,7 @@ fn check_class_attribute(checker: &Checker, attribute_expr: &ExprAttribute) {
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let mut diagnostic = checker.report_diagnostic(
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
Airflow3Removal {
|
||||
deprecated: attr.to_string(),
|
||||
replacement,
|
||||
@@ -315,6 +315,7 @@ fn check_class_attribute(checker: &Checker, attribute_expr: &ExprAttribute) {
|
||||
if let Some(fix) = fix {
|
||||
diagnostic.set_fix(fix);
|
||||
}
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
|
||||
/// Checks whether an Airflow 3.0–removed context key is used in a function decorated with `@task`.
|
||||
@@ -381,13 +382,13 @@ fn check_context_key_usage_in_call(checker: &Checker, call_expr: &ExprCall) {
|
||||
continue;
|
||||
};
|
||||
if value == removed_key {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
Airflow3Removal {
|
||||
deprecated: removed_key.to_string(),
|
||||
replacement: Replacement::None,
|
||||
},
|
||||
*range,
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -422,13 +423,13 @@ fn check_context_key_usage_in_subscript(checker: &Checker, subscript: &ExprSubsc
|
||||
}
|
||||
|
||||
if REMOVED_CONTEXT_KEYS.contains(&key.to_str()) {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
Airflow3Removal {
|
||||
deprecated: key.to_string(),
|
||||
replacement: Replacement::None,
|
||||
},
|
||||
slice.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -536,7 +537,7 @@ fn check_method(checker: &Checker, call_expr: &ExprCall) {
|
||||
None
|
||||
};
|
||||
|
||||
let mut diagnostic = checker.report_diagnostic(
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
Airflow3Removal {
|
||||
deprecated: attr.to_string(),
|
||||
replacement,
|
||||
@@ -546,6 +547,7 @@ fn check_method(checker: &Checker, call_expr: &ExprCall) {
|
||||
if let Some(fix) = fix {
|
||||
diagnostic.set_fix(fix);
|
||||
}
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
|
||||
/// Check whether a removed Airflow name is used.
|
||||
@@ -614,6 +616,7 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
|
||||
},
|
||||
|
||||
// airflow.configuration
|
||||
// TODO: check whether we could improve it
|
||||
[
|
||||
"airflow",
|
||||
"configuration",
|
||||
@@ -963,39 +966,37 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
|
||||
_ => return,
|
||||
};
|
||||
|
||||
let (module, name) = match &replacement {
|
||||
Replacement::AutoImport { module, name } => (module, *name),
|
||||
Replacement::SourceModuleMoved { module, name } => (module, name.as_str()),
|
||||
_ => {
|
||||
checker.report_diagnostic(
|
||||
Airflow3Removal {
|
||||
deprecated: qualified_name.to_string(),
|
||||
replacement: replacement.clone(),
|
||||
},
|
||||
range,
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if is_guarded_by_try_except(expr, module, name, checker.semantic()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let import_target = name.split('.').next().unwrap_or(name);
|
||||
let mut diagnostic = checker.report_diagnostic(
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
Airflow3Removal {
|
||||
deprecated: qualified_name.to_string(),
|
||||
replacement: replacement.clone(),
|
||||
},
|
||||
range,
|
||||
);
|
||||
let semantic = checker.semantic();
|
||||
if let Some((module, name)) = match &replacement {
|
||||
Replacement::AutoImport { module, name } => Some((module, *name)),
|
||||
Replacement::SourceModuleMoved { module, name } => Some((module, name.as_str())),
|
||||
_ => None,
|
||||
} {
|
||||
if is_guarded_by_try_except(expr, module, name, semantic) {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(fix) = generate_import_edit(expr, checker, module, import_target, range)
|
||||
.or_else(|| generate_remove_and_runtime_import_edit(expr, checker, module, name))
|
||||
{
|
||||
diagnostic.set_fix(fix);
|
||||
let import_target = name.split('.').next().unwrap_or(name);
|
||||
|
||||
diagnostic.try_set_fix(|| {
|
||||
let (import_edit, _) = checker.importer().get_or_import_symbol(
|
||||
&ImportRequest::import_from(module, import_target),
|
||||
expr.start(),
|
||||
checker.semantic(),
|
||||
)?;
|
||||
let replacement_edit = Edit::range_replacement(name.to_string(), range);
|
||||
Ok(Fix::safe_edits(import_edit, [replacement_edit]))
|
||||
});
|
||||
}
|
||||
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
|
||||
/// Check whether a customized Airflow plugin contains removed extensions.
|
||||
@@ -1027,7 +1028,7 @@ fn check_airflow_plugin_extension(
|
||||
)
|
||||
})
|
||||
}) {
|
||||
checker.report_diagnostic(
|
||||
checker.report_diagnostic(Diagnostic::new(
|
||||
Airflow3Removal {
|
||||
deprecated: name.to_string(),
|
||||
replacement: Replacement::Message(
|
||||
@@ -1035,7 +1036,7 @@ fn check_airflow_plugin_extension(
|
||||
),
|
||||
},
|
||||
expr.range(),
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1051,11 +1052,7 @@ fn diagnostic_for_argument(
|
||||
let Some(keyword) = arguments.find_keyword(deprecated) else {
|
||||
return;
|
||||
};
|
||||
let range = keyword
|
||||
.arg
|
||||
.as_ref()
|
||||
.map_or_else(|| keyword.range(), Ranged::range);
|
||||
let mut diagnostic = checker.report_diagnostic(
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
Airflow3Removal {
|
||||
deprecated: deprecated.to_string(),
|
||||
replacement: match replacement {
|
||||
@@ -1063,15 +1060,20 @@ fn diagnostic_for_argument(
|
||||
None => Replacement::None,
|
||||
},
|
||||
},
|
||||
range,
|
||||
keyword
|
||||
.arg
|
||||
.as_ref()
|
||||
.map_or_else(|| keyword.range(), Ranged::range),
|
||||
);
|
||||
|
||||
if let Some(replacement) = replacement {
|
||||
diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement(
|
||||
replacement.to_string(),
|
||||
range,
|
||||
diagnostic.range,
|
||||
)));
|
||||
}
|
||||
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
|
||||
/// Check whether the symbol is coming from the `secrets` builtin or provider module which ends
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
use crate::checkers::ast::Checker;
|
||||
use crate::rules::airflow::helpers::{
|
||||
ProviderReplacement, generate_import_edit, generate_remove_and_runtime_import_edit,
|
||||
is_guarded_by_try_except,
|
||||
};
|
||||
use crate::{FixAvailability, Violation};
|
||||
use crate::importer::ImportRequest;
|
||||
|
||||
use crate::rules::airflow::helpers::{ProviderReplacement, is_guarded_by_try_except};
|
||||
use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation};
|
||||
use ruff_macros::{ViolationMetadata, derive_message_formats};
|
||||
use ruff_python_ast::name::QualifiedName;
|
||||
use ruff_python_ast::{Expr, ExprAttribute};
|
||||
use ruff_python_semantic::Modules;
|
||||
use ruff_text_size::Ranged;
|
||||
use ruff_text_size::TextRange;
|
||||
|
||||
use crate::checkers::ast::Checker;
|
||||
|
||||
/// ## What it does
|
||||
/// Checks for uses of Airflow functions and values that have been moved to its providers
|
||||
/// but still have a compatibility layer (e.g., `apache-airflow-providers-standard`).
|
||||
@@ -31,12 +30,12 @@ use ruff_text_size::TextRange;
|
||||
/// from airflow.providers.standard.operators.python import PythonOperator
|
||||
/// ```
|
||||
#[derive(ViolationMetadata)]
|
||||
pub(crate) struct Airflow3SuggestedToMoveToProvider<'a> {
|
||||
deprecated: QualifiedName<'a>,
|
||||
pub(crate) struct Airflow3SuggestedToMoveToProvider {
|
||||
deprecated: String,
|
||||
replacement: ProviderReplacement,
|
||||
}
|
||||
|
||||
impl Violation for Airflow3SuggestedToMoveToProvider<'_> {
|
||||
impl Violation for Airflow3SuggestedToMoveToProvider {
|
||||
const FIX_AVAILABILITY: FixAvailability = FixAvailability::Sometimes;
|
||||
#[derive_message_formats]
|
||||
fn message(&self) -> String {
|
||||
@@ -282,37 +281,35 @@ fn check_names_moved_to_provider(checker: &Checker, expr: &Expr, ranged: TextRan
|
||||
_ => return,
|
||||
};
|
||||
|
||||
let (module, name) = match &replacement {
|
||||
ProviderReplacement::AutoImport { module, name, .. } => (module, *name),
|
||||
ProviderReplacement::SourceModuleMovedToProvider { module, name, .. } => {
|
||||
(module, name.as_str())
|
||||
}
|
||||
ProviderReplacement::None => {
|
||||
checker.report_diagnostic(
|
||||
Airflow3SuggestedToMoveToProvider {
|
||||
deprecated: qualified_name,
|
||||
replacement: replacement.clone(),
|
||||
},
|
||||
ranged.range(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if is_guarded_by_try_except(expr, module, name, checker.semantic()) {
|
||||
return;
|
||||
}
|
||||
let mut diagnostic = checker.report_diagnostic(
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
Airflow3SuggestedToMoveToProvider {
|
||||
deprecated: qualified_name,
|
||||
deprecated: qualified_name.to_string(),
|
||||
replacement: replacement.clone(),
|
||||
},
|
||||
ranged,
|
||||
ranged.range(),
|
||||
);
|
||||
|
||||
if let Some(fix) = generate_import_edit(expr, checker, module, name, ranged)
|
||||
.or_else(|| generate_remove_and_runtime_import_edit(expr, checker, module, name))
|
||||
{
|
||||
diagnostic.set_fix(fix);
|
||||
let semantic = checker.semantic();
|
||||
if let Some((module, name)) = match &replacement {
|
||||
ProviderReplacement::AutoImport { module, name, .. } => Some((module, *name)),
|
||||
ProviderReplacement::SourceModuleMovedToProvider { module, name, .. } => {
|
||||
Some((module, name.as_str()))
|
||||
}
|
||||
ProviderReplacement::None => None,
|
||||
} {
|
||||
if is_guarded_by_try_except(expr, module, name, semantic) {
|
||||
return;
|
||||
}
|
||||
diagnostic.try_set_fix(|| {
|
||||
let (import_edit, binding) = checker.importer().get_or_import_symbol(
|
||||
&ImportRequest::import_from(module, name),
|
||||
expr.start(),
|
||||
checker.semantic(),
|
||||
)?;
|
||||
let replacement_edit = Edit::range_replacement(binding, ranged.range());
|
||||
Ok(Fix::safe_edits(import_edit, [replacement_edit]))
|
||||
});
|
||||
}
|
||||
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
use crate::checkers::ast::Checker;
|
||||
use crate::rules::airflow::helpers::{Replacement, is_airflow_builtin_or_provider};
|
||||
use crate::importer::ImportRequest;
|
||||
use crate::rules::airflow::helpers::{
|
||||
generate_import_edit, generate_remove_and_runtime_import_edit, is_guarded_by_try_except,
|
||||
Replacement, is_airflow_builtin_or_provider, is_guarded_by_try_except,
|
||||
};
|
||||
use crate::{Edit, Fix, FixAvailability, Violation};
|
||||
use ruff_diagnostics::{Diagnostic, Edit, Fix, FixAvailability, Violation};
|
||||
use ruff_macros::{ViolationMetadata, derive_message_formats};
|
||||
use ruff_python_ast::{Arguments, Expr, ExprAttribute, ExprCall, ExprName, name::QualifiedName};
|
||||
use ruff_python_semantic::Modules;
|
||||
@@ -120,11 +120,7 @@ fn diagnostic_for_argument(
|
||||
let Some(keyword) = arguments.find_keyword(deprecated) else {
|
||||
return;
|
||||
};
|
||||
let range = keyword
|
||||
.arg
|
||||
.as_ref()
|
||||
.map_or_else(|| keyword.range(), Ranged::range);
|
||||
let mut diagnostic = checker.report_diagnostic(
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
Airflow3SuggestedUpdate {
|
||||
deprecated: deprecated.to_string(),
|
||||
replacement: match replacement {
|
||||
@@ -132,15 +128,20 @@ fn diagnostic_for_argument(
|
||||
None => Replacement::None,
|
||||
},
|
||||
},
|
||||
range,
|
||||
keyword
|
||||
.arg
|
||||
.as_ref()
|
||||
.map_or_else(|| keyword.range(), Ranged::range),
|
||||
);
|
||||
|
||||
if let Some(replacement) = replacement {
|
||||
diagnostic.set_fix(Fix::safe_edit(Edit::range_replacement(
|
||||
replacement.to_string(),
|
||||
range,
|
||||
diagnostic.range,
|
||||
)));
|
||||
}
|
||||
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
/// Check whether a removed Airflow argument is passed.
|
||||
///
|
||||
@@ -211,7 +212,7 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
|
||||
name: "AssetAny",
|
||||
},
|
||||
"expand_alias_to_datasets" => Replacement::AutoImport {
|
||||
module: "airflow.models.asset",
|
||||
module: "airflow.sdk",
|
||||
name: "expand_alias_to_assets",
|
||||
},
|
||||
_ => return,
|
||||
@@ -256,7 +257,7 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
|
||||
name: (*rest).to_string(),
|
||||
},
|
||||
["airflow", "models", "baseoperatorlink", "BaseOperatorLink"] => Replacement::AutoImport {
|
||||
module: "airflow.sdk",
|
||||
module: "airflow.sdk.definitions.baseoperatorlink",
|
||||
name: "BaseOperatorLink",
|
||||
},
|
||||
// airflow.model..DAG
|
||||
@@ -283,34 +284,33 @@ fn check_name(checker: &Checker, expr: &Expr, range: TextRange) {
|
||||
_ => return,
|
||||
};
|
||||
|
||||
let (module, name) = match &replacement {
|
||||
Replacement::AutoImport { module, name } => (module, *name),
|
||||
Replacement::SourceModuleMoved { module, name } => (module, name.as_str()),
|
||||
_ => {
|
||||
checker.report_diagnostic(
|
||||
Airflow3SuggestedUpdate {
|
||||
deprecated: qualified_name.to_string(),
|
||||
replacement: replacement.clone(),
|
||||
},
|
||||
range,
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if is_guarded_by_try_except(expr, module, name, checker.semantic()) {
|
||||
return;
|
||||
}
|
||||
let mut diagnostic = checker.report_diagnostic(
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
Airflow3SuggestedUpdate {
|
||||
deprecated: qualified_name.to_string(),
|
||||
replacement: replacement.clone(),
|
||||
},
|
||||
range,
|
||||
);
|
||||
if let Some(fix) = generate_import_edit(expr, checker, module, name, range)
|
||||
.or_else(|| generate_remove_and_runtime_import_edit(expr, checker, module, name))
|
||||
{
|
||||
diagnostic.set_fix(fix);
|
||||
|
||||
let semantic = checker.semantic();
|
||||
if let Some((module, name)) = match &replacement {
|
||||
Replacement::AutoImport { module, name } => Some((module, *name)),
|
||||
Replacement::SourceModuleMoved { module, name } => Some((module, name.as_str())),
|
||||
_ => None,
|
||||
} {
|
||||
if is_guarded_by_try_except(expr, module, name, semantic) {
|
||||
return;
|
||||
}
|
||||
diagnostic.try_set_fix(|| {
|
||||
let (import_edit, binding) = checker.importer().get_or_import_symbol(
|
||||
&ImportRequest::import_from(module, name),
|
||||
expr.start(),
|
||||
checker.semantic(),
|
||||
)?;
|
||||
let replacement_edit = Edit::range_replacement(binding, range);
|
||||
Ok(Fix::safe_edits(import_edit, [replacement_edit]))
|
||||
});
|
||||
}
|
||||
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Violation;
|
||||
use ruff_diagnostics::{Diagnostic, Violation};
|
||||
use ruff_macros::{ViolationMetadata, derive_message_formats};
|
||||
use ruff_python_ast as ast;
|
||||
use ruff_python_ast::Expr;
|
||||
@@ -110,10 +110,11 @@ pub(crate) fn variable_name_task_id(checker: &Checker, targets: &[Expr], value:
|
||||
return;
|
||||
}
|
||||
|
||||
checker.report_diagnostic(
|
||||
let diagnostic = Diagnostic::new(
|
||||
AirflowVariableNameTaskIdMismatch {
|
||||
task_id: task_id.to_string(),
|
||||
},
|
||||
target.range(),
|
||||
);
|
||||
checker.report_diagnostic(diagnostic);
|
||||
}
|
||||
|
||||
@@ -1,294 +1,651 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR301_names.py:38:1: AIR301 `airflow.PY36` is removed in Airflow 3.0
|
||||
AIR301_names.py:53:1: AIR301 `airflow.PY36` is removed in Airflow 3.0
|
||||
|
|
||||
37 | # airflow root
|
||||
38 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
52 | # airflow root
|
||||
53 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
| ^^^^ AIR301
|
||||
39 |
|
||||
40 | # airflow.api_connexion.security
|
||||
54 |
|
||||
55 | # airflow.api_connexion.security
|
||||
|
|
||||
= help: Use `sys.version_info` instead
|
||||
|
||||
AIR301_names.py:38:7: AIR301 `airflow.PY37` is removed in Airflow 3.0
|
||||
AIR301_names.py:53:7: AIR301 `airflow.PY37` is removed in Airflow 3.0
|
||||
|
|
||||
37 | # airflow root
|
||||
38 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
52 | # airflow root
|
||||
53 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
| ^^^^ AIR301
|
||||
39 |
|
||||
40 | # airflow.api_connexion.security
|
||||
54 |
|
||||
55 | # airflow.api_connexion.security
|
||||
|
|
||||
= help: Use `sys.version_info` instead
|
||||
|
||||
AIR301_names.py:38:13: AIR301 `airflow.PY38` is removed in Airflow 3.0
|
||||
AIR301_names.py:53:13: AIR301 `airflow.PY38` is removed in Airflow 3.0
|
||||
|
|
||||
37 | # airflow root
|
||||
38 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
52 | # airflow root
|
||||
53 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
| ^^^^ AIR301
|
||||
39 |
|
||||
40 | # airflow.api_connexion.security
|
||||
54 |
|
||||
55 | # airflow.api_connexion.security
|
||||
|
|
||||
= help: Use `sys.version_info` instead
|
||||
|
||||
AIR301_names.py:38:19: AIR301 `airflow.PY39` is removed in Airflow 3.0
|
||||
AIR301_names.py:53:19: AIR301 `airflow.PY39` is removed in Airflow 3.0
|
||||
|
|
||||
37 | # airflow root
|
||||
38 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
52 | # airflow root
|
||||
53 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
| ^^^^ AIR301
|
||||
39 |
|
||||
40 | # airflow.api_connexion.security
|
||||
54 |
|
||||
55 | # airflow.api_connexion.security
|
||||
|
|
||||
= help: Use `sys.version_info` instead
|
||||
|
||||
AIR301_names.py:38:25: AIR301 `airflow.PY310` is removed in Airflow 3.0
|
||||
AIR301_names.py:53:25: AIR301 `airflow.PY310` is removed in Airflow 3.0
|
||||
|
|
||||
37 | # airflow root
|
||||
38 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
52 | # airflow root
|
||||
53 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
| ^^^^^ AIR301
|
||||
39 |
|
||||
40 | # airflow.api_connexion.security
|
||||
54 |
|
||||
55 | # airflow.api_connexion.security
|
||||
|
|
||||
= help: Use `sys.version_info` instead
|
||||
|
||||
AIR301_names.py:38:32: AIR301 `airflow.PY311` is removed in Airflow 3.0
|
||||
AIR301_names.py:53:32: AIR301 `airflow.PY311` is removed in Airflow 3.0
|
||||
|
|
||||
37 | # airflow root
|
||||
38 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
52 | # airflow root
|
||||
53 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
| ^^^^^ AIR301
|
||||
39 |
|
||||
40 | # airflow.api_connexion.security
|
||||
54 |
|
||||
55 | # airflow.api_connexion.security
|
||||
|
|
||||
= help: Use `sys.version_info` instead
|
||||
|
||||
AIR301_names.py:38:39: AIR301 `airflow.PY312` is removed in Airflow 3.0
|
||||
AIR301_names.py:53:39: AIR301 `airflow.PY312` is removed in Airflow 3.0
|
||||
|
|
||||
37 | # airflow root
|
||||
38 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
52 | # airflow root
|
||||
53 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
| ^^^^^ AIR301
|
||||
39 |
|
||||
40 | # airflow.api_connexion.security
|
||||
54 |
|
||||
55 | # airflow.api_connexion.security
|
||||
|
|
||||
= help: Use `sys.version_info` instead
|
||||
|
||||
AIR301_names.py:41:1: AIR301 `airflow.api_connexion.security.requires_access` is removed in Airflow 3.0
|
||||
AIR301_names.py:56:1: AIR301 `airflow.api_connexion.security.requires_access` is removed in Airflow 3.0
|
||||
|
|
||||
40 | # airflow.api_connexion.security
|
||||
41 | requires_access
|
||||
55 | # airflow.api_connexion.security
|
||||
56 | requires_access
|
||||
| ^^^^^^^^^^^^^^^ AIR301
|
||||
42 |
|
||||
43 | # airflow.contrib.*
|
||||
|
|
||||
= help: Use `airflow.api_fastapi.core_api.security.requires_access_*` instead
|
||||
|
||||
AIR301_names.py:44:1: AIR301 `airflow.contrib.aws_athena_hook.AWSAthenaHook` is removed in Airflow 3.0
|
||||
AIR301_names.py:60:1: AIR301 [*] `airflow.configuration.get` is removed in Airflow 3.0
|
||||
|
|
||||
43 | # airflow.contrib.*
|
||||
44 | AWSAthenaHook()
|
||||
59 | # airflow.configuration
|
||||
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^ AIR301
|
||||
|
|
||||
= help: Use `conf.get` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
19 19 | has_option,
|
||||
20 20 | remove_option,
|
||||
21 21 | set,
|
||||
22 |+conf,
|
||||
22 23 | )
|
||||
23 24 | from airflow.contrib.aws_athena_hook import AWSAthenaHook
|
||||
24 25 | from airflow.datasets import DatasetAliasEvent
|
||||
--------------------------------------------------------------------------------
|
||||
57 58 |
|
||||
58 59 |
|
||||
59 60 | # airflow.configuration
|
||||
60 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 |+conf.get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 62 |
|
||||
62 63 |
|
||||
63 64 | # airflow.contrib.*
|
||||
|
||||
AIR301_names.py:60:6: AIR301 [*] `airflow.configuration.getboolean` is removed in Airflow 3.0
|
||||
|
|
||||
59 | # airflow.configuration
|
||||
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `conf.getboolean` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
19 19 | has_option,
|
||||
20 20 | remove_option,
|
||||
21 21 | set,
|
||||
22 |+conf,
|
||||
22 23 | )
|
||||
23 24 | from airflow.contrib.aws_athena_hook import AWSAthenaHook
|
||||
24 25 | from airflow.datasets import DatasetAliasEvent
|
||||
--------------------------------------------------------------------------------
|
||||
57 58 |
|
||||
58 59 |
|
||||
59 60 | # airflow.configuration
|
||||
60 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 |+get, conf.getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 62 |
|
||||
62 63 |
|
||||
63 64 | # airflow.contrib.*
|
||||
|
||||
AIR301_names.py:60:18: AIR301 [*] `airflow.configuration.getfloat` is removed in Airflow 3.0
|
||||
|
|
||||
59 | # airflow.configuration
|
||||
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `conf.getfloat` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
19 19 | has_option,
|
||||
20 20 | remove_option,
|
||||
21 21 | set,
|
||||
22 |+conf,
|
||||
22 23 | )
|
||||
23 24 | from airflow.contrib.aws_athena_hook import AWSAthenaHook
|
||||
24 25 | from airflow.datasets import DatasetAliasEvent
|
||||
--------------------------------------------------------------------------------
|
||||
57 58 |
|
||||
58 59 |
|
||||
59 60 | # airflow.configuration
|
||||
60 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 |+get, getboolean, conf.getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 62 |
|
||||
62 63 |
|
||||
63 64 | # airflow.contrib.*
|
||||
|
||||
AIR301_names.py:60:28: AIR301 [*] `airflow.configuration.getint` is removed in Airflow 3.0
|
||||
|
|
||||
59 | # airflow.configuration
|
||||
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `conf.getint` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
19 19 | has_option,
|
||||
20 20 | remove_option,
|
||||
21 21 | set,
|
||||
22 |+conf,
|
||||
22 23 | )
|
||||
23 24 | from airflow.contrib.aws_athena_hook import AWSAthenaHook
|
||||
24 25 | from airflow.datasets import DatasetAliasEvent
|
||||
--------------------------------------------------------------------------------
|
||||
57 58 |
|
||||
58 59 |
|
||||
59 60 | # airflow.configuration
|
||||
60 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 |+get, getboolean, getfloat, conf.getint, has_option, remove_option, as_dict, set
|
||||
61 62 |
|
||||
62 63 |
|
||||
63 64 | # airflow.contrib.*
|
||||
|
||||
AIR301_names.py:60:36: AIR301 [*] `airflow.configuration.has_option` is removed in Airflow 3.0
|
||||
|
|
||||
59 | # airflow.configuration
|
||||
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `conf.has_option` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
19 19 | has_option,
|
||||
20 20 | remove_option,
|
||||
21 21 | set,
|
||||
22 |+conf,
|
||||
22 23 | )
|
||||
23 24 | from airflow.contrib.aws_athena_hook import AWSAthenaHook
|
||||
24 25 | from airflow.datasets import DatasetAliasEvent
|
||||
--------------------------------------------------------------------------------
|
||||
57 58 |
|
||||
58 59 |
|
||||
59 60 | # airflow.configuration
|
||||
60 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 |+get, getboolean, getfloat, getint, conf.has_option, remove_option, as_dict, set
|
||||
61 62 |
|
||||
62 63 |
|
||||
63 64 | # airflow.contrib.*
|
||||
|
||||
AIR301_names.py:60:48: AIR301 [*] `airflow.configuration.remove_option` is removed in Airflow 3.0
|
||||
|
|
||||
59 | # airflow.configuration
|
||||
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `conf.remove_option` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
19 19 | has_option,
|
||||
20 20 | remove_option,
|
||||
21 21 | set,
|
||||
22 |+conf,
|
||||
22 23 | )
|
||||
23 24 | from airflow.contrib.aws_athena_hook import AWSAthenaHook
|
||||
24 25 | from airflow.datasets import DatasetAliasEvent
|
||||
--------------------------------------------------------------------------------
|
||||
57 58 |
|
||||
58 59 |
|
||||
59 60 | # airflow.configuration
|
||||
60 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 |+get, getboolean, getfloat, getint, has_option, conf.remove_option, as_dict, set
|
||||
61 62 |
|
||||
62 63 |
|
||||
63 64 | # airflow.contrib.*
|
||||
|
||||
AIR301_names.py:60:63: AIR301 [*] `airflow.configuration.as_dict` is removed in Airflow 3.0
|
||||
|
|
||||
59 | # airflow.configuration
|
||||
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `conf.as_dict` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
19 19 | has_option,
|
||||
20 20 | remove_option,
|
||||
21 21 | set,
|
||||
22 |+conf,
|
||||
22 23 | )
|
||||
23 24 | from airflow.contrib.aws_athena_hook import AWSAthenaHook
|
||||
24 25 | from airflow.datasets import DatasetAliasEvent
|
||||
--------------------------------------------------------------------------------
|
||||
57 58 |
|
||||
58 59 |
|
||||
59 60 | # airflow.configuration
|
||||
60 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 |+get, getboolean, getfloat, getint, has_option, remove_option, conf.as_dict, set
|
||||
61 62 |
|
||||
62 63 |
|
||||
63 64 | # airflow.contrib.*
|
||||
|
||||
AIR301_names.py:60:72: AIR301 [*] `airflow.configuration.set` is removed in Airflow 3.0
|
||||
|
|
||||
59 | # airflow.configuration
|
||||
60 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^ AIR301
|
||||
|
|
||||
= help: Use `conf.set` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
19 19 | has_option,
|
||||
20 20 | remove_option,
|
||||
21 21 | set,
|
||||
22 |+conf,
|
||||
22 23 | )
|
||||
23 24 | from airflow.contrib.aws_athena_hook import AWSAthenaHook
|
||||
24 25 | from airflow.datasets import DatasetAliasEvent
|
||||
--------------------------------------------------------------------------------
|
||||
57 58 |
|
||||
58 59 |
|
||||
59 60 | # airflow.configuration
|
||||
60 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
61 |+get, getboolean, getfloat, getint, has_option, remove_option, as_dict, conf.set
|
||||
61 62 |
|
||||
62 63 |
|
||||
63 64 | # airflow.contrib.*
|
||||
|
||||
AIR301_names.py:64:1: AIR301 `airflow.contrib.aws_athena_hook.AWSAthenaHook` is removed in Airflow 3.0
|
||||
|
|
||||
63 | # airflow.contrib.*
|
||||
64 | AWSAthenaHook()
|
||||
| ^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: The whole `airflow.contrib` module has been removed.
|
||||
|
||||
AIR301_names.py:48:1: AIR301 `airflow.datasets.DatasetAliasEvent` is removed in Airflow 3.0
|
||||
AIR301_names.py:68:1: AIR301 `airflow.datasets.DatasetAliasEvent` is removed in Airflow 3.0
|
||||
|
|
||||
47 | # airflow.datasets
|
||||
48 | DatasetAliasEvent()
|
||||
67 | # airflow.datasets
|
||||
68 | DatasetAliasEvent()
|
||||
| ^^^^^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
|
||||
AIR301_names.py:52:1: AIR301 `airflow.operators.subdag.SubDagOperator` is removed in Airflow 3.0
|
||||
AIR301_names.py:72:1: AIR301 `airflow.hooks.base_hook.BaseHook` is removed in Airflow 3.0
|
||||
|
|
||||
51 | # airflow.operators.subdag.*
|
||||
52 | SubDagOperator()
|
||||
71 | # airflow.hooks
|
||||
72 | BaseHook()
|
||||
| ^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `BaseHook` from `airflow.hooks.base` instead.
|
||||
|
||||
AIR301_names.py:76:1: AIR301 `airflow.operators.subdag.SubDagOperator` is removed in Airflow 3.0
|
||||
|
|
||||
75 | # airflow.operators.subdag.*
|
||||
76 | SubDagOperator()
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: The whole `airflow.subdag` module has been removed.
|
||||
|
||||
AIR301_names.py:61:1: AIR301 `airflow.triggers.external_task.TaskStateTrigger` is removed in Airflow 3.0
|
||||
AIR301_names.py:85:1: AIR301 `airflow.sensors.base_sensor_operator.BaseSensorOperator` is removed in Airflow 3.0
|
||||
|
|
||||
60 | # airflow.triggers.external_task
|
||||
61 | TaskStateTrigger()
|
||||
| ^^^^^^^^^^^^^^^^ AIR301
|
||||
62 |
|
||||
63 | # airflow.utils.date
|
||||
|
|
||||
|
||||
AIR301_names.py:64:1: AIR301 `airflow.utils.dates.date_range` is removed in Airflow 3.0
|
||||
|
|
||||
63 | # airflow.utils.date
|
||||
64 | dates.date_range
|
||||
| ^^^^^^^^^^^^^^^^ AIR301
|
||||
65 | dates.days_ago
|
||||
|
|
||||
|
||||
AIR301_names.py:65:1: AIR301 `airflow.utils.dates.days_ago` is removed in Airflow 3.0
|
||||
|
|
||||
63 | # airflow.utils.date
|
||||
64 | dates.date_range
|
||||
65 | dates.days_ago
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
66 |
|
||||
67 | date_range
|
||||
|
|
||||
= help: Use `pendulum.today('UTC').add(days=-N, ...)` instead
|
||||
|
||||
AIR301_names.py:67:1: AIR301 `airflow.utils.dates.date_range` is removed in Airflow 3.0
|
||||
|
|
||||
65 | dates.days_ago
|
||||
66 |
|
||||
67 | date_range
|
||||
| ^^^^^^^^^^ AIR301
|
||||
68 | days_ago
|
||||
69 | infer_time_unit
|
||||
|
|
||||
|
||||
AIR301_names.py:68:1: AIR301 `airflow.utils.dates.days_ago` is removed in Airflow 3.0
|
||||
|
|
||||
67 | date_range
|
||||
68 | days_ago
|
||||
| ^^^^^^^^ AIR301
|
||||
69 | infer_time_unit
|
||||
70 | parse_execution_date
|
||||
|
|
||||
= help: Use `pendulum.today('UTC').add(days=-N, ...)` instead
|
||||
|
||||
AIR301_names.py:69:1: AIR301 `airflow.utils.dates.infer_time_unit` is removed in Airflow 3.0
|
||||
|
|
||||
67 | date_range
|
||||
68 | days_ago
|
||||
69 | infer_time_unit
|
||||
| ^^^^^^^^^^^^^^^ AIR301
|
||||
70 | parse_execution_date
|
||||
71 | round_time
|
||||
|
|
||||
|
||||
AIR301_names.py:70:1: AIR301 `airflow.utils.dates.parse_execution_date` is removed in Airflow 3.0
|
||||
|
|
||||
68 | days_ago
|
||||
69 | infer_time_unit
|
||||
70 | parse_execution_date
|
||||
| ^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
71 | round_time
|
||||
72 | scale_time_units
|
||||
|
|
||||
|
||||
AIR301_names.py:71:1: AIR301 `airflow.utils.dates.round_time` is removed in Airflow 3.0
|
||||
|
|
||||
69 | infer_time_unit
|
||||
70 | parse_execution_date
|
||||
71 | round_time
|
||||
| ^^^^^^^^^^ AIR301
|
||||
72 | scale_time_units
|
||||
|
|
||||
|
||||
AIR301_names.py:72:1: AIR301 `airflow.utils.dates.scale_time_units` is removed in Airflow 3.0
|
||||
|
|
||||
70 | parse_execution_date
|
||||
71 | round_time
|
||||
72 | scale_time_units
|
||||
| ^^^^^^^^^^^^^^^^ AIR301
|
||||
73 |
|
||||
74 | # This one was not deprecated.
|
||||
|
|
||||
|
||||
AIR301_names.py:79:1: AIR301 `airflow.utils.dag_cycle_tester.test_cycle` is removed in Airflow 3.0
|
||||
|
|
||||
78 | # airflow.utils.dag_cycle_tester
|
||||
79 | test_cycle
|
||||
| ^^^^^^^^^^ AIR301
|
||||
|
|
||||
|
||||
AIR301_names.py:83:1: AIR301 `airflow.utils.db.create_session` is removed in Airflow 3.0
|
||||
|
|
||||
82 | # airflow.utils.db
|
||||
83 | create_session
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
84 |
|
||||
85 | # airflow.utils.decorators
|
||||
|
|
||||
|
||||
AIR301_names.py:86:1: AIR301 `airflow.utils.decorators.apply_defaults` is removed in Airflow 3.0
|
||||
|
|
||||
85 | # airflow.utils.decorators
|
||||
86 | apply_defaults
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
87 |
|
||||
88 | # airflow.utils.file
|
||||
|
|
||||
= help: `apply_defaults` is now unconditionally done and can be safely removed.
|
||||
|
||||
AIR301_names.py:89:1: AIR301 `airflow.utils.file.mkdirs` is removed in Airflow 3.0
|
||||
|
|
||||
88 | # airflow.utils.file
|
||||
89 | mkdirs
|
||||
| ^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `pathlib.Path({path}).mkdir` instead
|
||||
|
||||
AIR301_names.py:93:1: AIR301 `airflow.utils.state.SHUTDOWN` is removed in Airflow 3.0
|
||||
|
|
||||
92 | # airflow.utils.state
|
||||
93 | SHUTDOWN
|
||||
| ^^^^^^^^ AIR301
|
||||
94 | terminating_states
|
||||
|
|
||||
|
||||
AIR301_names.py:94:1: AIR301 `airflow.utils.state.terminating_states` is removed in Airflow 3.0
|
||||
|
|
||||
92 | # airflow.utils.state
|
||||
93 | SHUTDOWN
|
||||
94 | terminating_states
|
||||
84 | # airflow.sensors.base_sensor_operator
|
||||
85 | BaseSensorOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
95 |
|
||||
96 | # airflow.utils.trigger_rule
|
||||
|
|
||||
= help: Use `BaseSensorOperator` from `airflow.sdk.bases.sensor` instead.
|
||||
|
||||
AIR301_names.py:89:1: AIR301 `airflow.triggers.external_task.TaskStateTrigger` is removed in Airflow 3.0
|
||||
|
|
||||
88 | # airflow.triggers.external_task
|
||||
89 | TaskStateTrigger()
|
||||
| ^^^^^^^^^^^^^^^^ AIR301
|
||||
90 |
|
||||
91 | # airflow.utils.date
|
||||
|
|
||||
|
||||
AIR301_names.py:97:1: AIR301 `airflow.utils.trigger_rule.TriggerRule.DUMMY` is removed in Airflow 3.0
|
||||
AIR301_names.py:92:1: AIR301 `airflow.utils.dates.date_range` is removed in Airflow 3.0
|
||||
|
|
||||
96 | # airflow.utils.trigger_rule
|
||||
97 | TriggerRule.DUMMY
|
||||
| ^^^^^^^^^^^^^^^^^ AIR301
|
||||
98 | TriggerRule.NONE_FAILED_OR_SKIPPED
|
||||
91 | # airflow.utils.date
|
||||
92 | dates.date_range
|
||||
| ^^^^^^^^^^^^^^^^ AIR301
|
||||
93 | dates.days_ago
|
||||
|
|
||||
|
||||
AIR301_names.py:98:1: AIR301 `airflow.utils.trigger_rule.TriggerRule.NONE_FAILED_OR_SKIPPED` is removed in Airflow 3.0
|
||||
AIR301_names.py:93:1: AIR301 `airflow.utils.dates.days_ago` is removed in Airflow 3.0
|
||||
|
|
||||
96 | # airflow.utils.trigger_rule
|
||||
97 | TriggerRule.DUMMY
|
||||
98 | TriggerRule.NONE_FAILED_OR_SKIPPED
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
91 | # airflow.utils.date
|
||||
92 | dates.date_range
|
||||
93 | dates.days_ago
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
94 |
|
||||
95 | date_range
|
||||
|
|
||||
= help: Use `pendulum.today('UTC').add(days=-N, ...)` instead
|
||||
|
||||
AIR301_names.py:95:1: AIR301 `airflow.utils.dates.date_range` is removed in Airflow 3.0
|
||||
|
|
||||
93 | dates.days_ago
|
||||
94 |
|
||||
95 | date_range
|
||||
| ^^^^^^^^^^ AIR301
|
||||
96 | days_ago
|
||||
97 | infer_time_unit
|
||||
|
|
||||
|
||||
AIR301_names.py:102:1: AIR301 `airflow.www.auth.has_access` is removed in Airflow 3.0
|
||||
AIR301_names.py:96:1: AIR301 `airflow.utils.dates.days_ago` is removed in Airflow 3.0
|
||||
|
|
||||
95 | date_range
|
||||
96 | days_ago
|
||||
| ^^^^^^^^ AIR301
|
||||
97 | infer_time_unit
|
||||
98 | parse_execution_date
|
||||
|
|
||||
= help: Use `pendulum.today('UTC').add(days=-N, ...)` instead
|
||||
|
||||
AIR301_names.py:97:1: AIR301 `airflow.utils.dates.infer_time_unit` is removed in Airflow 3.0
|
||||
|
|
||||
95 | date_range
|
||||
96 | days_ago
|
||||
97 | infer_time_unit
|
||||
| ^^^^^^^^^^^^^^^ AIR301
|
||||
98 | parse_execution_date
|
||||
99 | round_time
|
||||
|
|
||||
|
||||
AIR301_names.py:98:1: AIR301 `airflow.utils.dates.parse_execution_date` is removed in Airflow 3.0
|
||||
|
|
||||
101 | # airflow.www.auth
|
||||
102 | has_access
|
||||
96 | days_ago
|
||||
97 | infer_time_unit
|
||||
98 | parse_execution_date
|
||||
| ^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
99 | round_time
|
||||
100 | scale_time_units
|
||||
|
|
||||
|
||||
AIR301_names.py:99:1: AIR301 `airflow.utils.dates.round_time` is removed in Airflow 3.0
|
||||
|
|
||||
97 | infer_time_unit
|
||||
98 | parse_execution_date
|
||||
99 | round_time
|
||||
| ^^^^^^^^^^ AIR301
|
||||
103 | has_access_dataset
|
||||
100 | scale_time_units
|
||||
|
|
||||
|
||||
AIR301_names.py:103:1: AIR301 `airflow.www.auth.has_access_dataset` is removed in Airflow 3.0
|
||||
AIR301_names.py:100:1: AIR301 `airflow.utils.dates.scale_time_units` is removed in Airflow 3.0
|
||||
|
|
||||
101 | # airflow.www.auth
|
||||
102 | has_access
|
||||
103 | has_access_dataset
|
||||
98 | parse_execution_date
|
||||
99 | round_time
|
||||
100 | scale_time_units
|
||||
| ^^^^^^^^^^^^^^^^ AIR301
|
||||
101 |
|
||||
102 | # This one was not deprecated.
|
||||
|
|
||||
|
||||
AIR301_names.py:107:1: AIR301 `airflow.utils.dag_cycle_tester.test_cycle` is removed in Airflow 3.0
|
||||
|
|
||||
106 | # airflow.utils.dag_cycle_tester
|
||||
107 | test_cycle
|
||||
| ^^^^^^^^^^ AIR301
|
||||
|
|
||||
|
||||
AIR301_names.py:111:1: AIR301 `airflow.utils.db.create_session` is removed in Airflow 3.0
|
||||
|
|
||||
110 | # airflow.utils.db
|
||||
111 | create_session
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
112 |
|
||||
113 | # airflow.utils.decorators
|
||||
|
|
||||
|
||||
AIR301_names.py:114:1: AIR301 `airflow.utils.decorators.apply_defaults` is removed in Airflow 3.0
|
||||
|
|
||||
113 | # airflow.utils.decorators
|
||||
114 | apply_defaults
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
115 |
|
||||
116 | # airflow.utils.file
|
||||
|
|
||||
= help: `apply_defaults` is now unconditionally done and can be safely removed.
|
||||
|
||||
AIR301_names.py:117:1: AIR301 `airflow.utils.file.TemporaryDirectory` is removed in Airflow 3.0
|
||||
|
|
||||
116 | # airflow.utils.file
|
||||
117 | TemporaryDirectory()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
104 |
|
||||
105 | # airflow.www.utils
|
||||
118 | mkdirs
|
||||
|
|
||||
= help: Use `TemporaryDirectory` from `tempfile` instead.
|
||||
|
||||
AIR301_names.py:118:1: AIR301 `airflow.utils.file.mkdirs` is removed in Airflow 3.0
|
||||
|
|
||||
116 | # airflow.utils.file
|
||||
117 | TemporaryDirectory()
|
||||
118 | mkdirs
|
||||
| ^^^^^^ AIR301
|
||||
119 |
|
||||
120 | # airflow.utils.helpers
|
||||
|
|
||||
= help: Use `pathlib.Path({path}).mkdir` instead
|
||||
|
||||
AIR301_names.py:121:1: AIR301 [*] `airflow.utils.helpers.chain` is removed in Airflow 3.0
|
||||
|
|
||||
120 | # airflow.utils.helpers
|
||||
121 | helper_chain
|
||||
| ^^^^^^^^^^^^ AIR301
|
||||
122 | helper_cross_downstream
|
||||
|
|
||||
= help: Use `chain` from `airflow.sdk` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
48 48 | from airflow.utils.trigger_rule import TriggerRule
|
||||
49 49 | from airflow.www.auth import has_access
|
||||
50 50 | from airflow.www.utils import get_sensitive_variables_fields, should_hide_value_for_key
|
||||
51 |+from airflow.sdk import chain
|
||||
51 52 |
|
||||
52 53 | # airflow root
|
||||
53 54 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
--------------------------------------------------------------------------------
|
||||
118 119 | mkdirs
|
||||
119 120 |
|
||||
120 121 | # airflow.utils.helpers
|
||||
121 |-helper_chain
|
||||
122 |+chain
|
||||
122 123 | helper_cross_downstream
|
||||
123 124 |
|
||||
124 125 | # airflow.utils.log
|
||||
|
||||
AIR301_names.py:122:1: AIR301 [*] `airflow.utils.helpers.cross_downstream` is removed in Airflow 3.0
|
||||
|
|
||||
120 | # airflow.utils.helpers
|
||||
121 | helper_chain
|
||||
122 | helper_cross_downstream
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
123 |
|
||||
124 | # airflow.utils.log
|
||||
|
|
||||
= help: Use `cross_downstream` from `airflow.sdk` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
48 48 | from airflow.utils.trigger_rule import TriggerRule
|
||||
49 49 | from airflow.www.auth import has_access
|
||||
50 50 | from airflow.www.utils import get_sensitive_variables_fields, should_hide_value_for_key
|
||||
51 |+from airflow.sdk import cross_downstream
|
||||
51 52 |
|
||||
52 53 | # airflow root
|
||||
53 54 | PY36, PY37, PY38, PY39, PY310, PY311, PY312
|
||||
--------------------------------------------------------------------------------
|
||||
119 120 |
|
||||
120 121 | # airflow.utils.helpers
|
||||
121 122 | helper_chain
|
||||
122 |-helper_cross_downstream
|
||||
123 |+cross_downstream
|
||||
123 124 |
|
||||
124 125 | # airflow.utils.log
|
||||
125 126 | secrets_masker
|
||||
|
||||
AIR301_names.py:125:1: AIR301 `airflow.utils.log.secrets_masker` is removed in Airflow 3.0
|
||||
|
|
||||
124 | # airflow.utils.log
|
||||
125 | secrets_masker
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
126 |
|
||||
127 | # airflow.utils.state
|
||||
|
|
||||
= help: Use `secrets_masker` from `airflow.sdk.execution_time` instead.
|
||||
|
||||
AIR301_names.py:128:1: AIR301 `airflow.utils.state.SHUTDOWN` is removed in Airflow 3.0
|
||||
|
|
||||
127 | # airflow.utils.state
|
||||
128 | SHUTDOWN
|
||||
| ^^^^^^^^ AIR301
|
||||
129 | terminating_states
|
||||
|
|
||||
|
||||
AIR301_names.py:106:1: AIR301 `airflow.www.utils.get_sensitive_variables_fields` is removed in Airflow 3.0
|
||||
AIR301_names.py:129:1: AIR301 `airflow.utils.state.terminating_states` is removed in Airflow 3.0
|
||||
|
|
||||
105 | # airflow.www.utils
|
||||
106 | get_sensitive_variables_fields
|
||||
127 | # airflow.utils.state
|
||||
128 | SHUTDOWN
|
||||
129 | terminating_states
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
130 |
|
||||
131 | # airflow.utils.trigger_rule
|
||||
|
|
||||
|
||||
AIR301_names.py:132:1: AIR301 `airflow.utils.trigger_rule.TriggerRule.DUMMY` is removed in Airflow 3.0
|
||||
|
|
||||
131 | # airflow.utils.trigger_rule
|
||||
132 | TriggerRule.DUMMY
|
||||
| ^^^^^^^^^^^^^^^^^ AIR301
|
||||
133 | TriggerRule.NONE_FAILED_OR_SKIPPED
|
||||
|
|
||||
|
||||
AIR301_names.py:133:1: AIR301 `airflow.utils.trigger_rule.TriggerRule.NONE_FAILED_OR_SKIPPED` is removed in Airflow 3.0
|
||||
|
|
||||
131 | # airflow.utils.trigger_rule
|
||||
132 | TriggerRule.DUMMY
|
||||
133 | TriggerRule.NONE_FAILED_OR_SKIPPED
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
|
||||
AIR301_names.py:137:1: AIR301 `airflow.www.auth.has_access` is removed in Airflow 3.0
|
||||
|
|
||||
136 | # airflow.www.auth
|
||||
137 | has_access
|
||||
| ^^^^^^^^^^ AIR301
|
||||
138 |
|
||||
139 | # airflow.www.utils
|
||||
|
|
||||
|
||||
AIR301_names.py:140:1: AIR301 `airflow.www.utils.get_sensitive_variables_fields` is removed in Airflow 3.0
|
||||
|
|
||||
139 | # airflow.www.utils
|
||||
140 | get_sensitive_variables_fields
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
107 | should_hide_value_for_key
|
||||
141 | should_hide_value_for_key
|
||||
|
|
||||
|
||||
AIR301_names.py:107:1: AIR301 `airflow.www.utils.should_hide_value_for_key` is removed in Airflow 3.0
|
||||
AIR301_names.py:141:1: AIR301 `airflow.www.utils.should_hide_value_for_key` is removed in Airflow 3.0
|
||||
|
|
||||
105 | # airflow.www.utils
|
||||
106 | get_sensitive_variables_fields
|
||||
107 | should_hide_value_for_key
|
||||
139 | # airflow.www.utils
|
||||
140 | get_sensitive_variables_fields
|
||||
141 | should_hide_value_for_key
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
142 |
|
||||
143 | # airflow.operators.python
|
||||
|
|
||||
|
||||
AIR301_names.py:146:1: AIR301 `airflow.operators.python.get_current_context` is removed in Airflow 3.0
|
||||
|
|
||||
144 | from airflow.operators.python import get_current_context
|
||||
145 |
|
||||
146 | get_current_context()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
147 |
|
||||
148 | # airflow.providers.mysql
|
||||
|
|
||||
= help: Use `get_current_context` from `airflow.sdk` instead.
|
||||
|
||||
AIR301_names.py:151:1: AIR301 `airflow.providers.mysql.datasets.mysql.sanitize_uri` is removed in Airflow 3.0
|
||||
|
|
||||
149 | from airflow.providers.mysql.datasets.mysql import sanitize_uri
|
||||
150 |
|
||||
151 | sanitize_uri
|
||||
| ^^^^^^^^^^^^ AIR301
|
||||
152 |
|
||||
153 | # airflow.providers.postgres
|
||||
|
|
||||
= help: Use `sanitize_uri` from `airflow.providers.mysql.assets.mysql` instead.
|
||||
|
||||
AIR301_names.py:156:1: AIR301 `airflow.providers.postgres.datasets.postgres.sanitize_uri` is removed in Airflow 3.0
|
||||
|
|
||||
154 | from airflow.providers.postgres.datasets.postgres import sanitize_uri
|
||||
155 |
|
||||
156 | sanitize_uri
|
||||
| ^^^^^^^^^^^^ AIR301
|
||||
157 |
|
||||
158 | # airflow.providers.trino
|
||||
|
|
||||
= help: Use `sanitize_uri` from `airflow.providers.postgres.assets.postgres` instead.
|
||||
|
||||
AIR301_names.py:161:1: AIR301 `airflow.providers.trino.datasets.trino.sanitize_uri` is removed in Airflow 3.0
|
||||
|
|
||||
159 | from airflow.providers.trino.datasets.trino import sanitize_uri
|
||||
160 |
|
||||
161 | sanitize_uri
|
||||
| ^^^^^^^^^^^^ AIR301
|
||||
162 |
|
||||
163 | # airflow.notifications.basenotifier
|
||||
|
|
||||
= help: Use `sanitize_uri` from `airflow.providers.trino.assets.trino` instead.
|
||||
|
||||
AIR301_names.py:166:1: AIR301 `airflow.notifications.basenotifier.BaseNotifier` is removed in Airflow 3.0
|
||||
|
|
||||
164 | from airflow.notifications.basenotifier import BaseNotifier
|
||||
165 |
|
||||
166 | BaseNotifier()
|
||||
| ^^^^^^^^^^^^ AIR301
|
||||
167 |
|
||||
168 | # airflow.auth.manager
|
||||
|
|
||||
= help: Use `BaseNotifier` from `airflow.sdk.bases.notifier` instead.
|
||||
|
||||
AIR301_names.py:171:1: AIR301 `airflow.auth.managers.base_auth_manager.BaseAuthManager` is removed in Airflow 3.0
|
||||
|
|
||||
169 | from airflow.auth.managers.base_auth_manager import BaseAuthManager
|
||||
170 |
|
||||
171 | BaseAuthManager()
|
||||
| ^^^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `BaseAuthManager` from `airflow.api_fastapi.auth.managers.base_auth_manager` instead.
|
||||
|
||||
@@ -1,780 +1,296 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR301_names_fix.py:17:1: AIR301 [*] `airflow.api_connexion.security.requires_access_dataset` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:19:1: AIR301 [*] `airflow.api_connexion.security.requires_access_dataset` is removed in Airflow 3.0
|
||||
|
|
||||
15 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
16 |
|
||||
17 | requires_access_dataset()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
17 | from airflow.www.auth import has_access_dataset
|
||||
18 |
|
||||
19 | DatasetDetails()
|
||||
19 | requires_access_dataset()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
20 |
|
||||
21 | DatasetDetails()
|
||||
|
|
||||
= help: Use `requires_access_asset` from `airflow.api_fastapi.core_api.security` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
13 13 | from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
14 14 | from airflow.secrets.local_filesystem import load_connections
|
||||
15 15 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
16 |+from airflow.api_fastapi.core_api.security import requires_access_asset
|
||||
16 17 |
|
||||
17 |-requires_access_dataset()
|
||||
18 |+requires_access_asset()
|
||||
15 15 | from airflow.secrets.local_filesystm import load_connections
|
||||
16 16 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
17 17 | from airflow.www.auth import has_access_dataset
|
||||
18 |+from airflow.api_fastapi.core_api.security import requires_access_asset
|
||||
18 19 |
|
||||
19 20 | DatasetDetails()
|
||||
19 |-requires_access_dataset()
|
||||
20 |+requires_access_asset()
|
||||
20 21 |
|
||||
21 22 | DatasetDetails()
|
||||
22 23 |
|
||||
|
||||
AIR301_names_fix.py:19:1: AIR301 [*] `airflow.auth.managers.models.resource_details.DatasetDetails` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:21:1: AIR301 [*] `airflow.auth.managers.models.resource_details.DatasetDetails` is removed in Airflow 3.0
|
||||
|
|
||||
17 | requires_access_dataset()
|
||||
18 |
|
||||
19 | DatasetDetails()
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
19 | requires_access_dataset()
|
||||
20 |
|
||||
21 | DatasetManager()
|
||||
21 | DatasetDetails()
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `AssetDetails` from `airflow.api_fastapi.auth.managers.models.resource_details` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
13 13 | from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
14 14 | from airflow.secrets.local_filesystem import load_connections
|
||||
15 15 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
16 |+from airflow.api_fastapi.auth.managers.models.resource_details import AssetDetails
|
||||
16 17 |
|
||||
17 18 | requires_access_dataset()
|
||||
15 15 | from airflow.secrets.local_filesystm import load_connections
|
||||
16 16 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
17 17 | from airflow.www.auth import has_access_dataset
|
||||
18 |+from airflow.api_fastapi.auth.managers.models.resource_details import AssetDetails
|
||||
18 19 |
|
||||
19 |-DatasetDetails()
|
||||
20 |+AssetDetails()
|
||||
19 20 | requires_access_dataset()
|
||||
20 21 |
|
||||
21 22 | DatasetManager()
|
||||
22 23 | dataset_manager()
|
||||
21 |-DatasetDetails()
|
||||
22 |+AssetDetails()
|
||||
22 23 |
|
||||
23 24 |
|
||||
24 25 | DatasetManager()
|
||||
|
||||
AIR301_names_fix.py:21:1: AIR301 [*] `airflow.datasets.manager.DatasetManager` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:24:1: AIR301 [*] `airflow.datasets.manager.DatasetManager` is removed in Airflow 3.0
|
||||
|
|
||||
19 | DatasetDetails()
|
||||
20 |
|
||||
21 | DatasetManager()
|
||||
24 | DatasetManager()
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
22 | dataset_manager()
|
||||
23 | resolve_dataset_manager()
|
||||
25 | dataset_manager()
|
||||
26 | resolve_dataset_manager()
|
||||
|
|
||||
= help: Use `AssetManager` from `airflow.assets.manager` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
13 13 | from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
14 14 | from airflow.secrets.local_filesystem import load_connections
|
||||
15 15 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
16 |+from airflow.assets.manager import AssetManager
|
||||
16 17 |
|
||||
17 18 | requires_access_dataset()
|
||||
15 15 | from airflow.secrets.local_filesystm import load_connections
|
||||
16 16 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
17 17 | from airflow.www.auth import has_access_dataset
|
||||
18 |+from airflow.assets.manager import AssetManager
|
||||
18 19 |
|
||||
19 20 | DatasetDetails()
|
||||
19 20 | requires_access_dataset()
|
||||
20 21 |
|
||||
21 |-DatasetManager()
|
||||
22 |+AssetManager()
|
||||
22 23 | dataset_manager()
|
||||
23 24 | resolve_dataset_manager()
|
||||
24 25 |
|
||||
21 22 | DatasetDetails()
|
||||
22 23 |
|
||||
23 24 |
|
||||
24 |-DatasetManager()
|
||||
25 |+AssetManager()
|
||||
25 26 | dataset_manager()
|
||||
26 27 | resolve_dataset_manager()
|
||||
27 28 |
|
||||
|
||||
AIR301_names_fix.py:22:1: AIR301 [*] `airflow.datasets.manager.dataset_manager` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:25:1: AIR301 [*] `airflow.datasets.manager.dataset_manager` is removed in Airflow 3.0
|
||||
|
|
||||
21 | DatasetManager()
|
||||
22 | dataset_manager()
|
||||
24 | DatasetManager()
|
||||
25 | dataset_manager()
|
||||
| ^^^^^^^^^^^^^^^ AIR301
|
||||
23 | resolve_dataset_manager()
|
||||
26 | resolve_dataset_manager()
|
||||
|
|
||||
= help: Use `asset_manager` from `airflow.assets.manager` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
13 13 | from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
14 14 | from airflow.secrets.local_filesystem import load_connections
|
||||
15 15 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
16 |+from airflow.assets.manager import asset_manager
|
||||
16 17 |
|
||||
17 18 | requires_access_dataset()
|
||||
15 15 | from airflow.secrets.local_filesystm import load_connections
|
||||
16 16 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
17 17 | from airflow.www.auth import has_access_dataset
|
||||
18 |+from airflow.assets.manager import asset_manager
|
||||
18 19 |
|
||||
19 20 | DatasetDetails()
|
||||
19 20 | requires_access_dataset()
|
||||
20 21 |
|
||||
21 22 | DatasetManager()
|
||||
22 |-dataset_manager()
|
||||
23 |+asset_manager()
|
||||
23 24 | resolve_dataset_manager()
|
||||
24 25 |
|
||||
25 26 | DatasetLineageInfo()
|
||||
--------------------------------------------------------------------------------
|
||||
22 23 |
|
||||
23 24 |
|
||||
24 25 | DatasetManager()
|
||||
25 |-dataset_manager()
|
||||
26 |+asset_manager()
|
||||
26 27 | resolve_dataset_manager()
|
||||
27 28 |
|
||||
28 29 | DatasetLineageInfo()
|
||||
|
||||
AIR301_names_fix.py:23:1: AIR301 [*] `airflow.datasets.manager.resolve_dataset_manager` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:26:1: AIR301 [*] `airflow.datasets.manager.resolve_dataset_manager` is removed in Airflow 3.0
|
||||
|
|
||||
21 | DatasetManager()
|
||||
22 | dataset_manager()
|
||||
23 | resolve_dataset_manager()
|
||||
24 | DatasetManager()
|
||||
25 | dataset_manager()
|
||||
26 | resolve_dataset_manager()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
24 |
|
||||
25 | DatasetLineageInfo()
|
||||
27 |
|
||||
28 | DatasetLineageInfo()
|
||||
|
|
||||
= help: Use `resolve_asset_manager` from `airflow.assets.manager` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
13 13 | from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
14 14 | from airflow.secrets.local_filesystem import load_connections
|
||||
15 15 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
16 |+from airflow.assets.manager import resolve_asset_manager
|
||||
16 17 |
|
||||
17 18 | requires_access_dataset()
|
||||
15 15 | from airflow.secrets.local_filesystm import load_connections
|
||||
16 16 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
17 17 | from airflow.www.auth import has_access_dataset
|
||||
18 |+from airflow.assets.manager import resolve_asset_manager
|
||||
18 19 |
|
||||
--------------------------------------------------------------------------------
|
||||
19 20 | requires_access_dataset()
|
||||
20 21 |
|
||||
21 22 | DatasetManager()
|
||||
22 23 | dataset_manager()
|
||||
23 |-resolve_dataset_manager()
|
||||
24 |+resolve_asset_manager()
|
||||
24 25 |
|
||||
25 26 | DatasetLineageInfo()
|
||||
26 27 |
|
||||
--------------------------------------------------------------------------------
|
||||
23 24 |
|
||||
24 25 | DatasetManager()
|
||||
25 26 | dataset_manager()
|
||||
26 |-resolve_dataset_manager()
|
||||
27 |+resolve_asset_manager()
|
||||
27 28 |
|
||||
28 29 | DatasetLineageInfo()
|
||||
29 30 |
|
||||
|
||||
AIR301_names_fix.py:25:1: AIR301 [*] `airflow.lineage.hook.DatasetLineageInfo` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:28:1: AIR301 [*] `airflow.lineage.hook.DatasetLineageInfo` is removed in Airflow 3.0
|
||||
|
|
||||
23 | resolve_dataset_manager()
|
||||
24 |
|
||||
25 | DatasetLineageInfo()
|
||||
26 | resolve_dataset_manager()
|
||||
27 |
|
||||
28 | DatasetLineageInfo()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
26 |
|
||||
27 | AllowListValidator()
|
||||
29 |
|
||||
30 | AllowListValidator()
|
||||
|
|
||||
= help: Use `AssetLineageInfo` from `airflow.lineage.hook` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
9 9 | dataset_manager,
|
||||
10 10 | resolve_dataset_manager,
|
||||
11 11 | )
|
||||
12 |-from airflow.lineage.hook import DatasetLineageInfo
|
||||
12 |+from airflow.lineage.hook import DatasetLineageInfo, AssetLineageInfo
|
||||
13 13 | from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
14 14 | from airflow.secrets.local_filesystem import load_connections
|
||||
15 15 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
10 10 | dataset_manager,
|
||||
11 11 | resolve_dataset_manager,
|
||||
12 12 | )
|
||||
13 |-from airflow.lineage.hook import DatasetLineageInfo
|
||||
13 |+from airflow.lineage.hook import DatasetLineageInfo, AssetLineageInfo
|
||||
14 14 | from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
15 15 | from airflow.secrets.local_filesystm import load_connections
|
||||
16 16 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
--------------------------------------------------------------------------------
|
||||
22 22 | dataset_manager()
|
||||
23 23 | resolve_dataset_manager()
|
||||
24 24 |
|
||||
25 |-DatasetLineageInfo()
|
||||
25 |+AssetLineageInfo()
|
||||
26 26 |
|
||||
27 27 | AllowListValidator()
|
||||
28 28 | BlockListValidator()
|
||||
25 25 | dataset_manager()
|
||||
26 26 | resolve_dataset_manager()
|
||||
27 27 |
|
||||
28 |-DatasetLineageInfo()
|
||||
28 |+AssetLineageInfo()
|
||||
29 29 |
|
||||
30 30 | AllowListValidator()
|
||||
31 31 | BlockListValidator()
|
||||
|
||||
AIR301_names_fix.py:27:1: AIR301 [*] `airflow.metrics.validators.AllowListValidator` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:30:1: AIR301 [*] `airflow.metrics.validators.AllowListValidator` is removed in Airflow 3.0
|
||||
|
|
||||
25 | DatasetLineageInfo()
|
||||
26 |
|
||||
27 | AllowListValidator()
|
||||
28 | DatasetLineageInfo()
|
||||
29 |
|
||||
30 | AllowListValidator()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
28 | BlockListValidator()
|
||||
31 | BlockListValidator()
|
||||
|
|
||||
= help: Use `PatternAllowListValidator` from `airflow.metrics.validators` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
10 10 | resolve_dataset_manager,
|
||||
11 11 | )
|
||||
12 12 | from airflow.lineage.hook import DatasetLineageInfo
|
||||
13 |-from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
13 |+from airflow.metrics.validators import AllowListValidator, BlockListValidator, PatternAllowListValidator
|
||||
14 14 | from airflow.secrets.local_filesystem import load_connections
|
||||
15 15 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
16 16 |
|
||||
11 11 | resolve_dataset_manager,
|
||||
12 12 | )
|
||||
13 13 | from airflow.lineage.hook import DatasetLineageInfo
|
||||
14 |-from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
14 |+from airflow.metrics.validators import AllowListValidator, BlockListValidator, PatternAllowListValidator
|
||||
15 15 | from airflow.secrets.local_filesystm import load_connections
|
||||
16 16 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
17 17 | from airflow.www.auth import has_access_dataset
|
||||
--------------------------------------------------------------------------------
|
||||
24 24 |
|
||||
25 25 | DatasetLineageInfo()
|
||||
26 26 |
|
||||
27 |-AllowListValidator()
|
||||
27 |+PatternAllowListValidator()
|
||||
28 28 | BlockListValidator()
|
||||
27 27 |
|
||||
28 28 | DatasetLineageInfo()
|
||||
29 29 |
|
||||
30 30 | load_connections()
|
||||
30 |-AllowListValidator()
|
||||
30 |+PatternAllowListValidator()
|
||||
31 31 | BlockListValidator()
|
||||
32 32 |
|
||||
33 33 | load_connections()
|
||||
|
||||
AIR301_names_fix.py:28:1: AIR301 [*] `airflow.metrics.validators.BlockListValidator` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:31:1: AIR301 [*] `airflow.metrics.validators.BlockListValidator` is removed in Airflow 3.0
|
||||
|
|
||||
27 | AllowListValidator()
|
||||
28 | BlockListValidator()
|
||||
30 | AllowListValidator()
|
||||
31 | BlockListValidator()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
29 |
|
||||
30 | load_connections()
|
||||
32 |
|
||||
33 | load_connections()
|
||||
|
|
||||
= help: Use `PatternBlockListValidator` from `airflow.metrics.validators` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
10 10 | resolve_dataset_manager,
|
||||
11 11 | )
|
||||
12 12 | from airflow.lineage.hook import DatasetLineageInfo
|
||||
13 |-from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
13 |+from airflow.metrics.validators import AllowListValidator, BlockListValidator, PatternBlockListValidator
|
||||
14 14 | from airflow.secrets.local_filesystem import load_connections
|
||||
15 15 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
16 16 |
|
||||
11 11 | resolve_dataset_manager,
|
||||
12 12 | )
|
||||
13 13 | from airflow.lineage.hook import DatasetLineageInfo
|
||||
14 |-from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
14 |+from airflow.metrics.validators import AllowListValidator, BlockListValidator, PatternBlockListValidator
|
||||
15 15 | from airflow.secrets.local_filesystm import load_connections
|
||||
16 16 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
17 17 | from airflow.www.auth import has_access_dataset
|
||||
--------------------------------------------------------------------------------
|
||||
25 25 | DatasetLineageInfo()
|
||||
26 26 |
|
||||
27 27 | AllowListValidator()
|
||||
28 |-BlockListValidator()
|
||||
28 |+PatternBlockListValidator()
|
||||
28 28 | DatasetLineageInfo()
|
||||
29 29 |
|
||||
30 30 | load_connections()
|
||||
31 31 |
|
||||
30 30 | AllowListValidator()
|
||||
31 |-BlockListValidator()
|
||||
31 |+PatternBlockListValidator()
|
||||
32 32 |
|
||||
33 33 | load_connections()
|
||||
34 34 |
|
||||
|
||||
AIR301_names_fix.py:30:1: AIR301 [*] `airflow.secrets.local_filesystem.load_connections` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:35:1: AIR301 [*] `airflow.security.permissions.RESOURCE_DATASET` is removed in Airflow 3.0
|
||||
|
|
||||
28 | BlockListValidator()
|
||||
29 |
|
||||
30 | load_connections()
|
||||
| ^^^^^^^^^^^^^^^^ AIR301
|
||||
31 |
|
||||
32 | RESOURCE_DATASET
|
||||
|
|
||||
= help: Use `load_connections_dict` from `airflow.secrets.local_filesystem` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
11 11 | )
|
||||
12 12 | from airflow.lineage.hook import DatasetLineageInfo
|
||||
13 13 | from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
14 |-from airflow.secrets.local_filesystem import load_connections
|
||||
14 |+from airflow.secrets.local_filesystem import load_connections, load_connections_dict
|
||||
15 15 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
16 16 |
|
||||
17 17 | requires_access_dataset()
|
||||
--------------------------------------------------------------------------------
|
||||
27 27 | AllowListValidator()
|
||||
28 28 | BlockListValidator()
|
||||
29 29 |
|
||||
30 |-load_connections()
|
||||
30 |+load_connections_dict()
|
||||
31 31 |
|
||||
32 32 | RESOURCE_DATASET
|
||||
33 33 |
|
||||
|
||||
AIR301_names_fix.py:32:1: AIR301 [*] `airflow.security.permissions.RESOURCE_DATASET` is removed in Airflow 3.0
|
||||
|
|
||||
30 | load_connections()
|
||||
31 |
|
||||
32 | RESOURCE_DATASET
|
||||
33 | load_connections()
|
||||
34 |
|
||||
35 | RESOURCE_DATASET
|
||||
| ^^^^^^^^^^^^^^^^ AIR301
|
||||
36 |
|
||||
37 | has_access_dataset()
|
||||
|
|
||||
= help: Use `RESOURCE_ASSET` from `airflow.security.permissions` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
12 12 | from airflow.lineage.hook import DatasetLineageInfo
|
||||
13 13 | from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
14 14 | from airflow.secrets.local_filesystem import load_connections
|
||||
15 |-from airflow.security.permissions import RESOURCE_DATASET
|
||||
15 |+from airflow.security.permissions import RESOURCE_DATASET, RESOURCE_ASSET
|
||||
16 16 |
|
||||
17 17 | requires_access_dataset()
|
||||
13 13 | from airflow.lineage.hook import DatasetLineageInfo
|
||||
14 14 | from airflow.metrics.validators import AllowListValidator, BlockListValidator
|
||||
15 15 | from airflow.secrets.local_filesystm import load_connections
|
||||
16 |-from airflow.security.permissions import RESOURCE_DATASET
|
||||
16 |+from airflow.security.permissions import RESOURCE_DATASET, RESOURCE_ASSET
|
||||
17 17 | from airflow.www.auth import has_access_dataset
|
||||
18 18 |
|
||||
19 19 | requires_access_dataset()
|
||||
--------------------------------------------------------------------------------
|
||||
29 29 |
|
||||
30 30 | load_connections()
|
||||
31 31 |
|
||||
32 |-RESOURCE_DATASET
|
||||
32 |+RESOURCE_ASSET
|
||||
33 33 |
|
||||
32 32 |
|
||||
33 33 | load_connections()
|
||||
34 34 |
|
||||
35 35 | from airflow.listeners.spec.dataset import (
|
||||
35 |-RESOURCE_DATASET
|
||||
35 |+RESOURCE_ASSET
|
||||
36 36 |
|
||||
37 37 | has_access_dataset()
|
||||
38 38 |
|
||||
|
||||
AIR301_names_fix.py:40:1: AIR301 [*] `airflow.listeners.spec.dataset.on_dataset_created` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:37:1: AIR301 `airflow.www.auth.has_access_dataset` is removed in Airflow 3.0
|
||||
|
|
||||
38 | )
|
||||
39 |
|
||||
40 | on_dataset_created()
|
||||
35 | RESOURCE_DATASET
|
||||
36 |
|
||||
37 | has_access_dataset()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
41 | on_dataset_changed()
|
||||
38 |
|
||||
39 | from airflow.listeners.spec.dataset import (
|
||||
|
|
||||
|
||||
AIR301_names_fix.py:44:1: AIR301 [*] `airflow.listeners.spec.dataset.on_dataset_created` is removed in Airflow 3.0
|
||||
|
|
||||
42 | )
|
||||
43 |
|
||||
44 | on_dataset_created()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
45 | on_dataset_changed()
|
||||
|
|
||||
= help: Use `on_asset_created` from `airflow.listeners.spec.asset` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
36 36 | on_dataset_changed,
|
||||
37 37 | on_dataset_created,
|
||||
38 38 | )
|
||||
39 |+from airflow.listeners.spec.asset import on_asset_created
|
||||
39 40 |
|
||||
40 |-on_dataset_created()
|
||||
41 |+on_asset_created()
|
||||
41 42 | on_dataset_changed()
|
||||
42 43 |
|
||||
40 40 | on_dataset_changed,
|
||||
41 41 | on_dataset_created,
|
||||
42 42 | )
|
||||
43 |+from airflow.listeners.spec.asset import on_asset_created
|
||||
43 44 |
|
||||
44 |-on_dataset_created()
|
||||
45 |+on_asset_created()
|
||||
45 46 | on_dataset_changed()
|
||||
|
||||
AIR301_names_fix.py:41:1: AIR301 [*] `airflow.listeners.spec.dataset.on_dataset_changed` is removed in Airflow 3.0
|
||||
AIR301_names_fix.py:45:1: AIR301 [*] `airflow.listeners.spec.dataset.on_dataset_changed` is removed in Airflow 3.0
|
||||
|
|
||||
40 | on_dataset_created()
|
||||
41 | on_dataset_changed()
|
||||
44 | on_dataset_created()
|
||||
45 | on_dataset_changed()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `on_asset_changed` from `airflow.listeners.spec.asset` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
36 36 | on_dataset_changed,
|
||||
37 37 | on_dataset_created,
|
||||
38 38 | )
|
||||
39 |+from airflow.listeners.spec.asset import on_asset_changed
|
||||
39 40 |
|
||||
40 41 | on_dataset_created()
|
||||
41 |-on_dataset_changed()
|
||||
42 |+on_asset_changed()
|
||||
42 43 |
|
||||
40 40 | on_dataset_changed,
|
||||
41 41 | on_dataset_created,
|
||||
42 42 | )
|
||||
43 |+from airflow.listeners.spec.asset import on_asset_changed
|
||||
43 44 |
|
||||
44 45 | # airflow.operators.python
|
||||
|
||||
AIR301_names_fix.py:47:1: AIR301 [*] `airflow.operators.python.get_current_context` is removed in Airflow 3.0
|
||||
|
|
||||
45 | from airflow.operators.python import get_current_context
|
||||
46 |
|
||||
47 | get_current_context()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
48 |
|
||||
49 | # airflow.providers.mysql
|
||||
|
|
||||
= help: Use `get_current_context` from `airflow.sdk` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
42 42 |
|
||||
43 43 |
|
||||
44 44 | # airflow.operators.python
|
||||
45 |-from airflow.operators.python import get_current_context
|
||||
45 |+from airflow.sdk import get_current_context
|
||||
46 46 |
|
||||
47 47 | get_current_context()
|
||||
48 48 |
|
||||
|
||||
AIR301_names_fix.py:52:1: AIR301 [*] `airflow.providers.mysql.datasets.mysql.sanitize_uri` is removed in Airflow 3.0
|
||||
|
|
||||
50 | from airflow.providers.mysql.datasets.mysql import sanitize_uri
|
||||
51 |
|
||||
52 | sanitize_uri
|
||||
| ^^^^^^^^^^^^ AIR301
|
||||
53 |
|
||||
54 | # airflow.providers.postgres
|
||||
|
|
||||
= help: Use `sanitize_uri` from `airflow.providers.mysql.assets.mysql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
47 47 | get_current_context()
|
||||
48 48 |
|
||||
49 49 | # airflow.providers.mysql
|
||||
50 |-from airflow.providers.mysql.datasets.mysql import sanitize_uri
|
||||
50 |+from airflow.providers.mysql.assets.mysql import sanitize_uri
|
||||
51 51 |
|
||||
52 52 | sanitize_uri
|
||||
53 53 |
|
||||
|
||||
AIR301_names_fix.py:57:1: AIR301 [*] `airflow.providers.postgres.datasets.postgres.sanitize_uri` is removed in Airflow 3.0
|
||||
|
|
||||
55 | from airflow.providers.postgres.datasets.postgres import sanitize_uri
|
||||
56 |
|
||||
57 | sanitize_uri
|
||||
| ^^^^^^^^^^^^ AIR301
|
||||
58 |
|
||||
59 | # airflow.providers.trino
|
||||
|
|
||||
= help: Use `sanitize_uri` from `airflow.providers.postgres.assets.postgres` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
52 52 | sanitize_uri
|
||||
53 53 |
|
||||
54 54 | # airflow.providers.postgres
|
||||
55 |-from airflow.providers.postgres.datasets.postgres import sanitize_uri
|
||||
55 |+from airflow.providers.postgres.assets.postgres import sanitize_uri
|
||||
56 56 |
|
||||
57 57 | sanitize_uri
|
||||
58 58 |
|
||||
|
||||
AIR301_names_fix.py:62:1: AIR301 [*] `airflow.providers.trino.datasets.trino.sanitize_uri` is removed in Airflow 3.0
|
||||
|
|
||||
60 | from airflow.providers.trino.datasets.trino import sanitize_uri
|
||||
61 |
|
||||
62 | sanitize_uri
|
||||
| ^^^^^^^^^^^^ AIR301
|
||||
63 |
|
||||
64 | # airflow.notifications.basenotifier
|
||||
|
|
||||
= help: Use `sanitize_uri` from `airflow.providers.trino.assets.trino` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
57 57 | sanitize_uri
|
||||
58 58 |
|
||||
59 59 | # airflow.providers.trino
|
||||
60 |-from airflow.providers.trino.datasets.trino import sanitize_uri
|
||||
60 |+from airflow.providers.trino.assets.trino import sanitize_uri
|
||||
61 61 |
|
||||
62 62 | sanitize_uri
|
||||
63 63 |
|
||||
|
||||
AIR301_names_fix.py:67:1: AIR301 [*] `airflow.notifications.basenotifier.BaseNotifier` is removed in Airflow 3.0
|
||||
|
|
||||
65 | from airflow.notifications.basenotifier import BaseNotifier
|
||||
66 |
|
||||
67 | BaseNotifier()
|
||||
| ^^^^^^^^^^^^ AIR301
|
||||
68 |
|
||||
69 | # airflow.auth.manager
|
||||
|
|
||||
= help: Use `BaseNotifier` from `airflow.sdk.bases.notifier` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
62 62 | sanitize_uri
|
||||
63 63 |
|
||||
64 64 | # airflow.notifications.basenotifier
|
||||
65 |-from airflow.notifications.basenotifier import BaseNotifier
|
||||
65 |+from airflow.sdk.bases.notifier import BaseNotifier
|
||||
66 66 |
|
||||
67 67 | BaseNotifier()
|
||||
68 68 |
|
||||
|
||||
AIR301_names_fix.py:72:1: AIR301 [*] `airflow.auth.managers.base_auth_manager.BaseAuthManager` is removed in Airflow 3.0
|
||||
|
|
||||
70 | from airflow.auth.managers.base_auth_manager import BaseAuthManager
|
||||
71 |
|
||||
72 | BaseAuthManager()
|
||||
| ^^^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `BaseAuthManager` from `airflow.api_fastapi.auth.managers.base_auth_manager` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
67 67 | BaseNotifier()
|
||||
68 68 |
|
||||
69 69 | # airflow.auth.manager
|
||||
70 |-from airflow.auth.managers.base_auth_manager import BaseAuthManager
|
||||
70 |+from airflow.api_fastapi.auth.managers.base_auth_manager import BaseAuthManager
|
||||
71 71 |
|
||||
72 72 | BaseAuthManager()
|
||||
73 73 |
|
||||
|
||||
AIR301_names_fix.py:87:1: AIR301 [*] `airflow.configuration.get` is removed in Airflow 3.0
|
||||
|
|
||||
86 | # airflow.configuration
|
||||
87 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^ AIR301
|
||||
88 | from airflow.hooks.base_hook import BaseHook
|
||||
|
|
||||
= help: Use `conf.get` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
81 81 | has_option,
|
||||
82 82 | remove_option,
|
||||
83 83 | set,
|
||||
84 |+conf,
|
||||
84 85 | )
|
||||
85 86 |
|
||||
86 87 | # airflow.configuration
|
||||
87 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 |+conf, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 89 | from airflow.hooks.base_hook import BaseHook
|
||||
89 90 |
|
||||
90 91 | # airflow.hooks
|
||||
|
||||
AIR301_names_fix.py:87:6: AIR301 [*] `airflow.configuration.getboolean` is removed in Airflow 3.0
|
||||
|
|
||||
86 | # airflow.configuration
|
||||
87 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^^^^^ AIR301
|
||||
88 | from airflow.hooks.base_hook import BaseHook
|
||||
|
|
||||
= help: Use `conf.getboolean` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
81 81 | has_option,
|
||||
82 82 | remove_option,
|
||||
83 83 | set,
|
||||
84 |+conf,
|
||||
84 85 | )
|
||||
85 86 |
|
||||
86 87 | # airflow.configuration
|
||||
87 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 |+get, conf, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 89 | from airflow.hooks.base_hook import BaseHook
|
||||
89 90 |
|
||||
90 91 | # airflow.hooks
|
||||
|
||||
AIR301_names_fix.py:87:18: AIR301 [*] `airflow.configuration.getfloat` is removed in Airflow 3.0
|
||||
|
|
||||
86 | # airflow.configuration
|
||||
87 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^^^ AIR301
|
||||
88 | from airflow.hooks.base_hook import BaseHook
|
||||
|
|
||||
= help: Use `conf.getfloat` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
81 81 | has_option,
|
||||
82 82 | remove_option,
|
||||
83 83 | set,
|
||||
84 |+conf,
|
||||
84 85 | )
|
||||
85 86 |
|
||||
86 87 | # airflow.configuration
|
||||
87 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 |+get, getboolean, conf, getint, has_option, remove_option, as_dict, set
|
||||
88 89 | from airflow.hooks.base_hook import BaseHook
|
||||
89 90 |
|
||||
90 91 | # airflow.hooks
|
||||
|
||||
AIR301_names_fix.py:87:28: AIR301 [*] `airflow.configuration.getint` is removed in Airflow 3.0
|
||||
|
|
||||
86 | # airflow.configuration
|
||||
87 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^ AIR301
|
||||
88 | from airflow.hooks.base_hook import BaseHook
|
||||
|
|
||||
= help: Use `conf.getint` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
81 81 | has_option,
|
||||
82 82 | remove_option,
|
||||
83 83 | set,
|
||||
84 |+conf,
|
||||
84 85 | )
|
||||
85 86 |
|
||||
86 87 | # airflow.configuration
|
||||
87 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 |+get, getboolean, getfloat, conf, has_option, remove_option, as_dict, set
|
||||
88 89 | from airflow.hooks.base_hook import BaseHook
|
||||
89 90 |
|
||||
90 91 | # airflow.hooks
|
||||
|
||||
AIR301_names_fix.py:87:36: AIR301 [*] `airflow.configuration.has_option` is removed in Airflow 3.0
|
||||
|
|
||||
86 | # airflow.configuration
|
||||
87 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^^^^^ AIR301
|
||||
88 | from airflow.hooks.base_hook import BaseHook
|
||||
|
|
||||
= help: Use `conf.has_option` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
81 81 | has_option,
|
||||
82 82 | remove_option,
|
||||
83 83 | set,
|
||||
84 |+conf,
|
||||
84 85 | )
|
||||
85 86 |
|
||||
86 87 | # airflow.configuration
|
||||
87 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 |+get, getboolean, getfloat, getint, conf, remove_option, as_dict, set
|
||||
88 89 | from airflow.hooks.base_hook import BaseHook
|
||||
89 90 |
|
||||
90 91 | # airflow.hooks
|
||||
|
||||
AIR301_names_fix.py:87:48: AIR301 [*] `airflow.configuration.remove_option` is removed in Airflow 3.0
|
||||
|
|
||||
86 | # airflow.configuration
|
||||
87 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^^^^^^^^ AIR301
|
||||
88 | from airflow.hooks.base_hook import BaseHook
|
||||
|
|
||||
= help: Use `conf.remove_option` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
81 81 | has_option,
|
||||
82 82 | remove_option,
|
||||
83 83 | set,
|
||||
84 |+conf,
|
||||
84 85 | )
|
||||
85 86 |
|
||||
86 87 | # airflow.configuration
|
||||
87 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 |+get, getboolean, getfloat, getint, has_option, conf, as_dict, set
|
||||
88 89 | from airflow.hooks.base_hook import BaseHook
|
||||
89 90 |
|
||||
90 91 | # airflow.hooks
|
||||
|
||||
AIR301_names_fix.py:87:63: AIR301 [*] `airflow.configuration.as_dict` is removed in Airflow 3.0
|
||||
|
|
||||
86 | # airflow.configuration
|
||||
87 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^^^^^ AIR301
|
||||
88 | from airflow.hooks.base_hook import BaseHook
|
||||
|
|
||||
= help: Use `conf.as_dict` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
81 81 | has_option,
|
||||
82 82 | remove_option,
|
||||
83 83 | set,
|
||||
84 |+conf,
|
||||
84 85 | )
|
||||
85 86 |
|
||||
86 87 | # airflow.configuration
|
||||
87 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 |+get, getboolean, getfloat, getint, has_option, remove_option, conf, set
|
||||
88 89 | from airflow.hooks.base_hook import BaseHook
|
||||
89 90 |
|
||||
90 91 | # airflow.hooks
|
||||
|
||||
AIR301_names_fix.py:87:72: AIR301 [*] `airflow.configuration.set` is removed in Airflow 3.0
|
||||
|
|
||||
86 | # airflow.configuration
|
||||
87 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
| ^^^ AIR301
|
||||
88 | from airflow.hooks.base_hook import BaseHook
|
||||
|
|
||||
= help: Use `conf.set` from `airflow.configuration` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
81 81 | has_option,
|
||||
82 82 | remove_option,
|
||||
83 83 | set,
|
||||
84 |+conf,
|
||||
84 85 | )
|
||||
85 86 |
|
||||
86 87 | # airflow.configuration
|
||||
87 |-get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 |+get, getboolean, getfloat, getint, has_option, remove_option, as_dict, conf
|
||||
88 89 | from airflow.hooks.base_hook import BaseHook
|
||||
89 90 |
|
||||
90 91 | # airflow.hooks
|
||||
|
||||
AIR301_names_fix.py:91:1: AIR301 [*] `airflow.hooks.base_hook.BaseHook` is removed in Airflow 3.0
|
||||
|
|
||||
90 | # airflow.hooks
|
||||
91 | BaseHook()
|
||||
| ^^^^^^^^ AIR301
|
||||
92 |
|
||||
93 | from airflow.sensors.base_sensor_operator import BaseSensorOperator
|
||||
|
|
||||
= help: Use `BaseHook` from `airflow.hooks.base` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
85 85 |
|
||||
86 86 | # airflow.configuration
|
||||
87 87 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 |-from airflow.hooks.base_hook import BaseHook
|
||||
88 |+from airflow.hooks.base import BaseHook
|
||||
89 89 |
|
||||
90 90 | # airflow.hooks
|
||||
91 91 | BaseHook()
|
||||
|
||||
AIR301_names_fix.py:96:1: AIR301 [*] `airflow.sensors.base_sensor_operator.BaseSensorOperator` is removed in Airflow 3.0
|
||||
|
|
||||
95 | # airflow.sensors.base_sensor_operator
|
||||
96 | BaseSensorOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
97 | BaseHook()
|
||||
|
|
||||
= help: Use `BaseSensorOperator` from `airflow.sdk.bases.sensor` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
90 90 | # airflow.hooks
|
||||
91 91 | BaseHook()
|
||||
92 92 |
|
||||
93 |-from airflow.sensors.base_sensor_operator import BaseSensorOperator
|
||||
93 |+from airflow.sdk.bases.sensor import BaseSensorOperator
|
||||
94 94 |
|
||||
95 95 | # airflow.sensors.base_sensor_operator
|
||||
96 96 | BaseSensorOperator()
|
||||
|
||||
AIR301_names_fix.py:97:1: AIR301 [*] `airflow.hooks.base_hook.BaseHook` is removed in Airflow 3.0
|
||||
|
|
||||
95 | # airflow.sensors.base_sensor_operator
|
||||
96 | BaseSensorOperator()
|
||||
97 | BaseHook()
|
||||
| ^^^^^^^^ AIR301
|
||||
98 |
|
||||
99 | from airflow.utils.helpers import chain as helper_chain
|
||||
|
|
||||
= help: Use `BaseHook` from `airflow.hooks.base` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
85 85 |
|
||||
86 86 | # airflow.configuration
|
||||
87 87 | get, getboolean, getfloat, getint, has_option, remove_option, as_dict, set
|
||||
88 |-from airflow.hooks.base_hook import BaseHook
|
||||
89 88 |
|
||||
90 89 | # airflow.hooks
|
||||
91 90 | BaseHook()
|
||||
92 91 |
|
||||
93 92 | from airflow.sensors.base_sensor_operator import BaseSensorOperator
|
||||
93 |+from airflow.hooks.base import BaseHook
|
||||
94 94 |
|
||||
95 95 | # airflow.sensors.base_sensor_operator
|
||||
96 96 | BaseSensorOperator()
|
||||
|
||||
AIR301_names_fix.py:103:1: AIR301 [*] `airflow.utils.helpers.chain` is removed in Airflow 3.0
|
||||
|
|
||||
102 | # airflow.utils.helpers
|
||||
103 | helper_chain
|
||||
| ^^^^^^^^^^^^ AIR301
|
||||
104 | helper_cross_downstream
|
||||
|
|
||||
= help: Use `chain` from `airflow.sdk` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
98 98 |
|
||||
99 99 | from airflow.utils.helpers import chain as helper_chain
|
||||
100 100 | from airflow.utils.helpers import cross_downstream as helper_cross_downstream
|
||||
101 |+from airflow.sdk import chain
|
||||
101 102 |
|
||||
102 103 | # airflow.utils.helpers
|
||||
103 |-helper_chain
|
||||
104 |+chain
|
||||
104 105 | helper_cross_downstream
|
||||
105 106 |
|
||||
106 107 | # airflow.utils.file
|
||||
|
||||
AIR301_names_fix.py:104:1: AIR301 [*] `airflow.utils.helpers.cross_downstream` is removed in Airflow 3.0
|
||||
|
|
||||
102 | # airflow.utils.helpers
|
||||
103 | helper_chain
|
||||
104 | helper_cross_downstream
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
105 |
|
||||
106 | # airflow.utils.file
|
||||
|
|
||||
= help: Use `cross_downstream` from `airflow.sdk` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
98 98 |
|
||||
99 99 | from airflow.utils.helpers import chain as helper_chain
|
||||
100 100 | from airflow.utils.helpers import cross_downstream as helper_cross_downstream
|
||||
101 |+from airflow.sdk import cross_downstream
|
||||
101 102 |
|
||||
102 103 | # airflow.utils.helpers
|
||||
103 104 | helper_chain
|
||||
104 |-helper_cross_downstream
|
||||
105 |+cross_downstream
|
||||
105 106 |
|
||||
106 107 | # airflow.utils.file
|
||||
107 108 | from airflow.utils.file import TemporaryDirectory
|
||||
|
||||
AIR301_names_fix.py:109:1: AIR301 [*] `airflow.utils.file.TemporaryDirectory` is removed in Airflow 3.0
|
||||
|
|
||||
107 | from airflow.utils.file import TemporaryDirectory
|
||||
108 |
|
||||
109 | TemporaryDirectory()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
110 |
|
||||
111 | from airflow.utils.log import secrets_masker
|
||||
|
|
||||
= help: Use `TemporaryDirectory` from `tempfile` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
104 104 | helper_cross_downstream
|
||||
105 105 |
|
||||
106 106 | # airflow.utils.file
|
||||
107 |-from airflow.utils.file import TemporaryDirectory
|
||||
107 |+from tempfile import TemporaryDirectory
|
||||
108 108 |
|
||||
109 109 | TemporaryDirectory()
|
||||
110 110 |
|
||||
|
||||
AIR301_names_fix.py:114:1: AIR301 [*] `airflow.utils.log.secrets_masker` is removed in Airflow 3.0
|
||||
|
|
||||
113 | # airflow.utils.log
|
||||
114 | secrets_masker
|
||||
| ^^^^^^^^^^^^^^ AIR301
|
||||
|
|
||||
= help: Use `secrets_masker` from `airflow.sdk.execution_time` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
108 108 |
|
||||
109 109 | TemporaryDirectory()
|
||||
110 110 |
|
||||
111 |-from airflow.utils.log import secrets_masker
|
||||
111 |+from airflow.sdk.execution_time import secrets_masker
|
||||
112 112 |
|
||||
113 113 | # airflow.utils.log
|
||||
114 114 | secrets_masker
|
||||
44 45 | on_dataset_created()
|
||||
45 |-on_dataset_changed()
|
||||
46 |+on_asset_changed()
|
||||
|
||||
@@ -1,243 +1,216 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR301_provider_names_fix.py:11:1: AIR301 [*] `airflow.providers.amazon.aws.auth_manager.avp.entities.AvpEntities.DATASET` is removed in Airflow 3.0
|
||||
AIR301_provider_names_fix.py:25:1: AIR301 [*] `airflow.providers.amazon.aws.auth_manager.avp.entities.AvpEntities.DATASET` is removed in Airflow 3.0
|
||||
|
|
||||
9 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
10 |
|
||||
11 | AvpEntities.DATASET
|
||||
23 | )
|
||||
24 |
|
||||
25 | AvpEntities.DATASET
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
12 |
|
||||
13 | # airflow.providers.openlineage.utils.utils
|
||||
26 |
|
||||
27 | s3_create_dataset()
|
||||
|
|
||||
= help: Use `AvpEntities.ASSET` from `airflow.providers.amazon.aws.auth_manager.avp.entities` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
8 8 | from airflow.secrets.local_filesystem import load_connections
|
||||
9 9 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
10 10 |
|
||||
11 |-AvpEntities.DATASET
|
||||
11 |+AvpEntities
|
||||
12 12 |
|
||||
13 13 | # airflow.providers.openlineage.utils.utils
|
||||
14 14 | DatasetInfo()
|
||||
22 22 | translate_airflow_dataset,
|
||||
23 23 | )
|
||||
24 24 |
|
||||
25 |-AvpEntities.DATASET
|
||||
25 |+AvpEntities.ASSET
|
||||
26 26 |
|
||||
27 27 | s3_create_dataset()
|
||||
28 28 | s3_convert_dataset_to_openlineage()
|
||||
|
||||
AIR301_provider_names_fix.py:14:1: AIR301 [*] `airflow.providers.openlineage.utils.utils.DatasetInfo` is removed in Airflow 3.0
|
||||
AIR301_provider_names_fix.py:27:1: AIR301 [*] `airflow.providers.amazon.aws.datasets.s3.create_dataset` is removed in Airflow 3.0
|
||||
|
|
||||
13 | # airflow.providers.openlineage.utils.utils
|
||||
14 | DatasetInfo()
|
||||
| ^^^^^^^^^^^ AIR301
|
||||
15 | translate_airflow_dataset()
|
||||
|
|
||||
= help: Use `AssetInfo` from `airflow.providers.openlineage.utils.utils` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
4 4 | from airflow.providers.openlineage.utils.utils import (
|
||||
5 5 | DatasetInfo,
|
||||
6 6 | translate_airflow_dataset,
|
||||
7 |+AssetInfo,
|
||||
7 8 | )
|
||||
8 9 | from airflow.secrets.local_filesystem import load_connections
|
||||
9 10 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
--------------------------------------------------------------------------------
|
||||
11 12 | AvpEntities.DATASET
|
||||
12 13 |
|
||||
13 14 | # airflow.providers.openlineage.utils.utils
|
||||
14 |-DatasetInfo()
|
||||
15 |+AssetInfo()
|
||||
15 16 | translate_airflow_dataset()
|
||||
16 17 |
|
||||
17 18 | # airflow.secrets.local_filesystem
|
||||
|
||||
AIR301_provider_names_fix.py:15:1: AIR301 [*] `airflow.providers.openlineage.utils.utils.translate_airflow_dataset` is removed in Airflow 3.0
|
||||
|
|
||||
13 | # airflow.providers.openlineage.utils.utils
|
||||
14 | DatasetInfo()
|
||||
15 | translate_airflow_dataset()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
16 |
|
||||
17 | # airflow.secrets.local_filesystem
|
||||
|
|
||||
= help: Use `translate_airflow_asset` from `airflow.providers.openlineage.utils.utils` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
4 4 | from airflow.providers.openlineage.utils.utils import (
|
||||
5 5 | DatasetInfo,
|
||||
6 6 | translate_airflow_dataset,
|
||||
7 |+translate_airflow_asset,
|
||||
7 8 | )
|
||||
8 9 | from airflow.secrets.local_filesystem import load_connections
|
||||
9 10 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
--------------------------------------------------------------------------------
|
||||
12 13 |
|
||||
13 14 | # airflow.providers.openlineage.utils.utils
|
||||
14 15 | DatasetInfo()
|
||||
15 |-translate_airflow_dataset()
|
||||
16 |+translate_airflow_asset()
|
||||
16 17 |
|
||||
17 18 | # airflow.secrets.local_filesystem
|
||||
18 19 | load_connections()
|
||||
|
||||
AIR301_provider_names_fix.py:18:1: AIR301 [*] `airflow.secrets.local_filesystem.load_connections` is removed in Airflow 3.0
|
||||
|
|
||||
17 | # airflow.secrets.local_filesystem
|
||||
18 | load_connections()
|
||||
| ^^^^^^^^^^^^^^^^ AIR301
|
||||
19 |
|
||||
20 | # airflow.security.permissions
|
||||
|
|
||||
= help: Use `load_connections_dict` from `airflow.secrets.local_filesystem` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
5 5 | DatasetInfo,
|
||||
6 6 | translate_airflow_dataset,
|
||||
7 7 | )
|
||||
8 |-from airflow.secrets.local_filesystem import load_connections
|
||||
8 |+from airflow.secrets.local_filesystem import load_connections, load_connections_dict
|
||||
9 9 | from airflow.security.permissions import RESOURCE_DATASET
|
||||
10 10 |
|
||||
11 11 | AvpEntities.DATASET
|
||||
--------------------------------------------------------------------------------
|
||||
15 15 | translate_airflow_dataset()
|
||||
16 16 |
|
||||
17 17 | # airflow.secrets.local_filesystem
|
||||
18 |-load_connections()
|
||||
18 |+load_connections_dict()
|
||||
19 19 |
|
||||
20 20 | # airflow.security.permissions
|
||||
21 21 | RESOURCE_DATASET
|
||||
|
||||
AIR301_provider_names_fix.py:21:1: AIR301 [*] `airflow.security.permissions.RESOURCE_DATASET` is removed in Airflow 3.0
|
||||
|
|
||||
20 | # airflow.security.permissions
|
||||
21 | RESOURCE_DATASET
|
||||
| ^^^^^^^^^^^^^^^^ AIR301
|
||||
22 |
|
||||
23 | from airflow.providers.amazon.aws.datasets.s3 import (
|
||||
|
|
||||
= help: Use `RESOURCE_ASSET` from `airflow.security.permissions` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
6 6 | translate_airflow_dataset,
|
||||
7 7 | )
|
||||
8 8 | from airflow.secrets.local_filesystem import load_connections
|
||||
9 |-from airflow.security.permissions import RESOURCE_DATASET
|
||||
9 |+from airflow.security.permissions import RESOURCE_DATASET, RESOURCE_ASSET
|
||||
10 10 |
|
||||
11 11 | AvpEntities.DATASET
|
||||
12 12 |
|
||||
--------------------------------------------------------------------------------
|
||||
18 18 | load_connections()
|
||||
19 19 |
|
||||
20 20 | # airflow.security.permissions
|
||||
21 |-RESOURCE_DATASET
|
||||
21 |+RESOURCE_ASSET
|
||||
22 22 |
|
||||
23 23 | from airflow.providers.amazon.aws.datasets.s3 import (
|
||||
24 24 | convert_dataset_to_openlineage as s3_convert_dataset_to_openlineage,
|
||||
|
||||
AIR301_provider_names_fix.py:28:1: AIR301 [*] `airflow.providers.amazon.aws.datasets.s3.create_dataset` is removed in Airflow 3.0
|
||||
|
|
||||
26 | from airflow.providers.amazon.aws.datasets.s3 import create_dataset as s3_create_dataset
|
||||
27 |
|
||||
28 | s3_create_dataset()
|
||||
25 | AvpEntities.DATASET
|
||||
26 |
|
||||
27 | s3_create_dataset()
|
||||
| ^^^^^^^^^^^^^^^^^ AIR301
|
||||
29 | s3_convert_dataset_to_openlineage()
|
||||
28 | s3_convert_dataset_to_openlineage()
|
||||
|
|
||||
= help: Use `create_asset` from `airflow.providers.amazon.aws.assets.s3` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
24 24 | convert_dataset_to_openlineage as s3_convert_dataset_to_openlineage,
|
||||
25 25 | )
|
||||
26 26 | from airflow.providers.amazon.aws.datasets.s3 import create_dataset as s3_create_dataset
|
||||
27 |+from airflow.providers.amazon.aws.assets.s3 import create_asset
|
||||
27 28 |
|
||||
28 |-s3_create_dataset()
|
||||
29 |+create_asset()
|
||||
29 30 | s3_convert_dataset_to_openlineage()
|
||||
30 31 |
|
||||
31 32 | from airflow.providers.common.io.dataset.file import (
|
||||
21 21 | DatasetInfo,
|
||||
22 22 | translate_airflow_dataset,
|
||||
23 23 | )
|
||||
24 |+from airflow.providers.amazon.aws.assets.s3 import create_asset
|
||||
24 25 |
|
||||
25 26 | AvpEntities.DATASET
|
||||
26 27 |
|
||||
27 |-s3_create_dataset()
|
||||
28 |+create_asset()
|
||||
28 29 | s3_convert_dataset_to_openlineage()
|
||||
29 30 |
|
||||
30 31 | io_create_dataset()
|
||||
|
||||
AIR301_provider_names_fix.py:29:1: AIR301 [*] `airflow.providers.amazon.aws.datasets.s3.convert_dataset_to_openlineage` is removed in Airflow 3.0
|
||||
AIR301_provider_names_fix.py:28:1: AIR301 [*] `airflow.providers.amazon.aws.datasets.s3.convert_dataset_to_openlineage` is removed in Airflow 3.0
|
||||
|
|
||||
28 | s3_create_dataset()
|
||||
29 | s3_convert_dataset_to_openlineage()
|
||||
27 | s3_create_dataset()
|
||||
28 | s3_convert_dataset_to_openlineage()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
30 |
|
||||
31 | from airflow.providers.common.io.dataset.file import (
|
||||
29 |
|
||||
30 | io_create_dataset()
|
||||
|
|
||||
= help: Use `convert_asset_to_openlineage` from `airflow.providers.amazon.aws.assets.s3` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
24 24 | convert_dataset_to_openlineage as s3_convert_dataset_to_openlineage,
|
||||
25 25 | )
|
||||
26 26 | from airflow.providers.amazon.aws.datasets.s3 import create_dataset as s3_create_dataset
|
||||
27 |+from airflow.providers.amazon.aws.assets.s3 import convert_asset_to_openlineage
|
||||
27 28 |
|
||||
28 29 | s3_create_dataset()
|
||||
29 |-s3_convert_dataset_to_openlineage()
|
||||
30 |+convert_asset_to_openlineage()
|
||||
30 31 |
|
||||
31 32 | from airflow.providers.common.io.dataset.file import (
|
||||
32 33 | convert_dataset_to_openlineage as io_convert_dataset_to_openlineage,
|
||||
21 21 | DatasetInfo,
|
||||
22 22 | translate_airflow_dataset,
|
||||
23 23 | )
|
||||
24 |+from airflow.providers.amazon.aws.assets.s3 import convert_asset_to_openlineage
|
||||
24 25 |
|
||||
25 26 | AvpEntities.DATASET
|
||||
26 27 |
|
||||
27 28 | s3_create_dataset()
|
||||
28 |-s3_convert_dataset_to_openlineage()
|
||||
29 |+convert_asset_to_openlineage()
|
||||
29 30 |
|
||||
30 31 | io_create_dataset()
|
||||
31 32 | io_convert_dataset_to_openlineage()
|
||||
|
||||
AIR301_provider_names_fix.py:45:1: AIR301 [*] `airflow.providers.google.datasets.bigquery.create_dataset` is removed in Airflow 3.0
|
||||
AIR301_provider_names_fix.py:36:1: AIR301 [*] `airflow.providers.google.datasets.bigquery.create_dataset` is removed in Airflow 3.0
|
||||
|
|
||||
43 | )
|
||||
44 |
|
||||
45 | bigquery_create_dataset()
|
||||
35 | # airflow.providers.google.datasets.bigquery
|
||||
36 | bigquery_create_dataset()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
46 |
|
||||
47 | # airflow.providers.google.datasets.gcs
|
||||
37 | # airflow.providers.google.datasets.gcs
|
||||
38 | gcs_create_dataset()
|
||||
|
|
||||
= help: Use `create_asset` from `airflow.providers.google.assets.bigquery` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
41 41 | from airflow.providers.google.datasets.bigquery import (
|
||||
42 42 | create_dataset as bigquery_create_dataset,
|
||||
43 43 | )
|
||||
44 |+from airflow.providers.google.assets.bigquery import create_asset
|
||||
44 45 |
|
||||
45 |-bigquery_create_dataset()
|
||||
46 |+create_asset()
|
||||
46 47 |
|
||||
47 48 | # airflow.providers.google.datasets.gcs
|
||||
48 49 | from airflow.providers.google.datasets.gcs import (
|
||||
21 21 | DatasetInfo,
|
||||
22 22 | translate_airflow_dataset,
|
||||
23 23 | )
|
||||
24 |+from airflow.providers.google.assets.bigquery import create_asset
|
||||
24 25 |
|
||||
25 26 | AvpEntities.DATASET
|
||||
26 27 |
|
||||
--------------------------------------------------------------------------------
|
||||
33 34 |
|
||||
34 35 |
|
||||
35 36 | # airflow.providers.google.datasets.bigquery
|
||||
36 |-bigquery_create_dataset()
|
||||
37 |+create_asset()
|
||||
37 38 | # airflow.providers.google.datasets.gcs
|
||||
38 39 | gcs_create_dataset()
|
||||
39 40 | gcs_convert_dataset_to_openlineage()
|
||||
|
||||
AIR301_provider_names_fix.py:53:1: AIR301 [*] `airflow.providers.google.datasets.gcs.create_dataset` is removed in Airflow 3.0
|
||||
AIR301_provider_names_fix.py:38:1: AIR301 [*] `airflow.providers.google.datasets.gcs.create_dataset` is removed in Airflow 3.0
|
||||
|
|
||||
51 | from airflow.providers.google.datasets.gcs import create_dataset as gcs_create_dataset
|
||||
52 |
|
||||
53 | gcs_create_dataset()
|
||||
36 | bigquery_create_dataset()
|
||||
37 | # airflow.providers.google.datasets.gcs
|
||||
38 | gcs_create_dataset()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR301
|
||||
54 | gcs_convert_dataset_to_openlineage()
|
||||
39 | gcs_convert_dataset_to_openlineage()
|
||||
40 | # airflow.providers.openlineage.utils.utils
|
||||
|
|
||||
= help: Use `create_asset` from `airflow.providers.google.assets.gcs` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
49 49 | convert_dataset_to_openlineage as gcs_convert_dataset_to_openlineage,
|
||||
50 50 | )
|
||||
51 51 | from airflow.providers.google.datasets.gcs import create_dataset as gcs_create_dataset
|
||||
52 |+from airflow.providers.google.assets.gcs import create_asset
|
||||
52 53 |
|
||||
53 |-gcs_create_dataset()
|
||||
54 |+create_asset()
|
||||
54 55 | gcs_convert_dataset_to_openlineage()
|
||||
21 21 | DatasetInfo,
|
||||
22 22 | translate_airflow_dataset,
|
||||
23 23 | )
|
||||
24 |+from airflow.providers.google.assets.gcs import create_asset
|
||||
24 25 |
|
||||
25 26 | AvpEntities.DATASET
|
||||
26 27 |
|
||||
--------------------------------------------------------------------------------
|
||||
35 36 | # airflow.providers.google.datasets.bigquery
|
||||
36 37 | bigquery_create_dataset()
|
||||
37 38 | # airflow.providers.google.datasets.gcs
|
||||
38 |-gcs_create_dataset()
|
||||
39 |+create_asset()
|
||||
39 40 | gcs_convert_dataset_to_openlineage()
|
||||
40 41 | # airflow.providers.openlineage.utils.utils
|
||||
41 42 | DatasetInfo()
|
||||
|
||||
AIR301_provider_names_fix.py:54:1: AIR301 [*] `airflow.providers.google.datasets.gcs.convert_dataset_to_openlineage` is removed in Airflow 3.0
|
||||
AIR301_provider_names_fix.py:39:1: AIR301 [*] `airflow.providers.google.datasets.gcs.convert_dataset_to_openlineage` is removed in Airflow 3.0
|
||||
|
|
||||
53 | gcs_create_dataset()
|
||||
54 | gcs_convert_dataset_to_openlineage()
|
||||
37 | # airflow.providers.google.datasets.gcs
|
||||
38 | gcs_create_dataset()
|
||||
39 | gcs_convert_dataset_to_openlineage()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
40 | # airflow.providers.openlineage.utils.utils
|
||||
41 | DatasetInfo()
|
||||
|
|
||||
= help: Use `convert_asset_to_openlineage` from `airflow.providers.google.assets.gcs` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
49 49 | convert_dataset_to_openlineage as gcs_convert_dataset_to_openlineage,
|
||||
50 50 | )
|
||||
51 51 | from airflow.providers.google.datasets.gcs import create_dataset as gcs_create_dataset
|
||||
52 |+from airflow.providers.google.assets.gcs import convert_asset_to_openlineage
|
||||
52 53 |
|
||||
53 54 | gcs_create_dataset()
|
||||
54 |-gcs_convert_dataset_to_openlineage()
|
||||
55 |+convert_asset_to_openlineage()
|
||||
21 21 | DatasetInfo,
|
||||
22 22 | translate_airflow_dataset,
|
||||
23 23 | )
|
||||
24 |+from airflow.providers.google.assets.gcs import convert_asset_to_openlineage
|
||||
24 25 |
|
||||
25 26 | AvpEntities.DATASET
|
||||
26 27 |
|
||||
--------------------------------------------------------------------------------
|
||||
36 37 | bigquery_create_dataset()
|
||||
37 38 | # airflow.providers.google.datasets.gcs
|
||||
38 39 | gcs_create_dataset()
|
||||
39 |-gcs_convert_dataset_to_openlineage()
|
||||
40 |+convert_asset_to_openlineage()
|
||||
40 41 | # airflow.providers.openlineage.utils.utils
|
||||
41 42 | DatasetInfo()
|
||||
42 43 | translate_airflow_dataset()
|
||||
|
||||
AIR301_provider_names_fix.py:41:1: AIR301 [*] `airflow.providers.openlineage.utils.utils.DatasetInfo` is removed in Airflow 3.0
|
||||
|
|
||||
39 | gcs_convert_dataset_to_openlineage()
|
||||
40 | # airflow.providers.openlineage.utils.utils
|
||||
41 | DatasetInfo()
|
||||
| ^^^^^^^^^^^ AIR301
|
||||
42 | translate_airflow_dataset()
|
||||
43 | #
|
||||
|
|
||||
= help: Use `AssetInfo` from `airflow.providers.openlineage.utils.utils` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
20 20 | from airflow.providers.openlineage.utils.utils import (
|
||||
21 21 | DatasetInfo,
|
||||
22 22 | translate_airflow_dataset,
|
||||
23 |+AssetInfo,
|
||||
23 24 | )
|
||||
24 25 |
|
||||
25 26 | AvpEntities.DATASET
|
||||
--------------------------------------------------------------------------------
|
||||
38 39 | gcs_create_dataset()
|
||||
39 40 | gcs_convert_dataset_to_openlineage()
|
||||
40 41 | # airflow.providers.openlineage.utils.utils
|
||||
41 |-DatasetInfo()
|
||||
42 |+AssetInfo()
|
||||
42 43 | translate_airflow_dataset()
|
||||
43 44 | #
|
||||
44 45 | # airflow.secrets.local_filesystem
|
||||
|
||||
AIR301_provider_names_fix.py:42:1: AIR301 [*] `airflow.providers.openlineage.utils.utils.translate_airflow_dataset` is removed in Airflow 3.0
|
||||
|
|
||||
40 | # airflow.providers.openlineage.utils.utils
|
||||
41 | DatasetInfo()
|
||||
42 | translate_airflow_dataset()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ AIR301
|
||||
43 | #
|
||||
44 | # airflow.secrets.local_filesystem
|
||||
|
|
||||
= help: Use `translate_airflow_asset` from `airflow.providers.openlineage.utils.utils` instead.
|
||||
|
||||
ℹ Safe fix
|
||||
20 20 | from airflow.providers.openlineage.utils.utils import (
|
||||
21 21 | DatasetInfo,
|
||||
22 22 | translate_airflow_dataset,
|
||||
23 |+translate_airflow_asset,
|
||||
23 24 | )
|
||||
24 25 |
|
||||
25 26 | AvpEntities.DATASET
|
||||
--------------------------------------------------------------------------------
|
||||
39 40 | gcs_convert_dataset_to_openlineage()
|
||||
40 41 | # airflow.providers.openlineage.utils.utils
|
||||
41 42 | DatasetInfo()
|
||||
42 |-translate_airflow_dataset()
|
||||
43 |+translate_airflow_asset()
|
||||
43 44 | #
|
||||
44 45 | # airflow.secrets.local_filesystem
|
||||
45 46 | load_connections()
|
||||
|
||||
@@ -1,252 +1,113 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR302_amazon.py:14:1: AIR302 [*] `airflow.hooks.S3_hook.S3Hook` is moved into `amazon` provider in Airflow 3.0;
|
||||
AIR302_amazon.py:23:1: AIR302 `airflow.hooks.S3_hook.S3Hook` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
12 | from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
13 |
|
||||
14 | S3Hook()
|
||||
21 | from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
22 |
|
||||
23 | S3Hook()
|
||||
| ^^^^^^ AIR302
|
||||
15 | provide_bucket_name()
|
||||
24 | provide_bucket_name()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `S3Hook` from `airflow.providers.amazon.aws.hooks.s3` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.S3_hook import (
|
||||
4 |- S3Hook,
|
||||
5 4 | provide_bucket_name,
|
||||
6 5 | )
|
||||
7 6 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
|
||||
--------------------------------------------------------------------------------
|
||||
10 9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
|
||||
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
|
||||
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
12 |+from airflow.providers.amazon.aws.hooks.s3 import S3Hook
|
||||
13 13 |
|
||||
14 14 | S3Hook()
|
||||
15 15 | provide_bucket_name()
|
||||
|
||||
AIR302_amazon.py:15:1: AIR302 [*] `airflow.hooks.S3_hook.provide_bucket_name` is moved into `amazon` provider in Airflow 3.0;
|
||||
AIR302_amazon.py:24:1: AIR302 `airflow.hooks.S3_hook.provide_bucket_name` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
14 | S3Hook()
|
||||
15 | provide_bucket_name()
|
||||
23 | S3Hook()
|
||||
24 | provide_bucket_name()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
16 |
|
||||
17 | GCSToS3Operator()
|
||||
25 |
|
||||
26 | GCSToS3Operator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `provide_bucket_name` from `airflow.providers.amazon.aws.hooks.s3` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.S3_hook import (
|
||||
4 4 | S3Hook,
|
||||
5 |- provide_bucket_name,
|
||||
6 5 | )
|
||||
7 6 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
|
||||
8 7 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
|
||||
--------------------------------------------------------------------------------
|
||||
10 9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
|
||||
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
|
||||
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
12 |+from airflow.providers.amazon.aws.hooks.s3 import provide_bucket_name
|
||||
13 13 |
|
||||
14 14 | S3Hook()
|
||||
15 15 | provide_bucket_name()
|
||||
|
||||
AIR302_amazon.py:17:1: AIR302 [*] `airflow.operators.gcs_to_s3.GCSToS3Operator` is moved into `amazon` provider in Airflow 3.0;
|
||||
AIR302_amazon.py:26:1: AIR302 `airflow.operators.gcs_to_s3.GCSToS3Operator` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
15 | provide_bucket_name()
|
||||
16 |
|
||||
17 | GCSToS3Operator()
|
||||
24 | provide_bucket_name()
|
||||
25 |
|
||||
26 | GCSToS3Operator()
|
||||
| ^^^^^^^^^^^^^^^ AIR302
|
||||
18 | GoogleApiToS3Operator()
|
||||
19 | RedshiftToS3Operator()
|
||||
27 |
|
||||
28 | GoogleApiToS3Operator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `GCSToS3Operator` from `airflow.providers.amazon.aws.transfers.gcs_to_s3` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | S3Hook,
|
||||
5 5 | provide_bucket_name,
|
||||
6 6 | )
|
||||
7 |-from airflow.operators.gcs_to_s3 import GCSToS3Operator
|
||||
8 7 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
|
||||
9 8 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
|
||||
10 9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
|
||||
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
|
||||
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
12 |+from airflow.providers.amazon.aws.transfers.gcs_to_s3 import GCSToS3Operator
|
||||
13 13 |
|
||||
14 14 | S3Hook()
|
||||
15 15 | provide_bucket_name()
|
||||
|
||||
AIR302_amazon.py:18:1: AIR302 [*] `airflow.operators.google_api_to_s3_transfer.GoogleApiToS3Operator` is moved into `amazon` provider in Airflow 3.0;
|
||||
AIR302_amazon.py:28:1: AIR302 `airflow.operators.google_api_to_s3_transfer.GoogleApiToS3Operator` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
17 | GCSToS3Operator()
|
||||
18 | GoogleApiToS3Operator()
|
||||
26 | GCSToS3Operator()
|
||||
27 |
|
||||
28 | GoogleApiToS3Operator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
19 | RedshiftToS3Operator()
|
||||
20 | S3FileTransformOperator()
|
||||
29 | GoogleApiToS3Transfer()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `GoogleApiToS3Operator` from `airflow.providers.amazon.aws.transfers.google_api_to_s3` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | provide_bucket_name,
|
||||
6 6 | )
|
||||
7 7 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
|
||||
8 |-from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
|
||||
9 8 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
|
||||
10 9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
|
||||
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
|
||||
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
12 |+from airflow.providers.amazon.aws.transfers.google_api_to_s3 import GoogleApiToS3Operator
|
||||
13 13 |
|
||||
14 14 | S3Hook()
|
||||
15 15 | provide_bucket_name()
|
||||
|
||||
AIR302_amazon.py:19:1: AIR302 [*] `airflow.operators.redshift_to_s3_operator.RedshiftToS3Operator` is moved into `amazon` provider in Airflow 3.0;
|
||||
AIR302_amazon.py:29:1: AIR302 `airflow.operators.google_api_to_s3_transfer.GoogleApiToS3Transfer` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
17 | GCSToS3Operator()
|
||||
18 | GoogleApiToS3Operator()
|
||||
19 | RedshiftToS3Operator()
|
||||
28 | GoogleApiToS3Operator()
|
||||
29 | GoogleApiToS3Transfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
30 |
|
||||
31 | RedshiftToS3Operator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `GoogleApiToS3Operator` from `airflow.providers.amazon.aws.transfers.google_api_to_s3` instead.
|
||||
|
||||
AIR302_amazon.py:31:1: AIR302 `airflow.operators.redshift_to_s3_operator.RedshiftToS3Operator` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
29 | GoogleApiToS3Transfer()
|
||||
30 |
|
||||
31 | RedshiftToS3Operator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
20 | S3FileTransformOperator()
|
||||
21 | S3ToRedshiftOperator()
|
||||
32 | RedshiftToS3Transfer()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `RedshiftToS3Operator` from `airflow.providers.amazon.aws.transfers.redshift_to_s3` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
6 6 | )
|
||||
7 7 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
|
||||
8 8 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
|
||||
9 |-from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
|
||||
10 9 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
|
||||
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
|
||||
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
12 |+from airflow.providers.amazon.aws.transfers.redshift_to_s3 import RedshiftToS3Operator
|
||||
13 13 |
|
||||
14 14 | S3Hook()
|
||||
15 15 | provide_bucket_name()
|
||||
|
||||
AIR302_amazon.py:20:1: AIR302 [*] `airflow.operators.s3_file_transform_operator.S3FileTransformOperator` is moved into `amazon` provider in Airflow 3.0;
|
||||
AIR302_amazon.py:32:1: AIR302 `airflow.operators.redshift_to_s3_operator.RedshiftToS3Transfer` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
18 | GoogleApiToS3Operator()
|
||||
19 | RedshiftToS3Operator()
|
||||
20 | S3FileTransformOperator()
|
||||
31 | RedshiftToS3Operator()
|
||||
32 | RedshiftToS3Transfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
33 |
|
||||
34 | S3FileTransformOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `RedshiftToS3Operator` from `airflow.providers.amazon.aws.transfers.redshift_to_s3` instead.
|
||||
|
||||
AIR302_amazon.py:34:1: AIR302 `airflow.operators.s3_file_transform_operator.S3FileTransformOperator` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
32 | RedshiftToS3Transfer()
|
||||
33 |
|
||||
34 | S3FileTransformOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
21 | S3ToRedshiftOperator()
|
||||
22 | S3KeySensor()
|
||||
35 |
|
||||
36 | S3ToRedshiftOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=3.0.0` and use `S3FileTransformOperator` from `airflow.providers.amazon.aws.operators.s3` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | from airflow.operators.gcs_to_s3 import GCSToS3Operator
|
||||
8 8 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
|
||||
9 9 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
|
||||
10 |-from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
|
||||
11 10 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
|
||||
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
12 |+from airflow.providers.amazon.aws.operators.s3 import S3FileTransformOperator
|
||||
13 13 |
|
||||
14 14 | S3Hook()
|
||||
15 15 | provide_bucket_name()
|
||||
|
||||
AIR302_amazon.py:21:1: AIR302 [*] `airflow.operators.s3_to_redshift_operator.S3ToRedshiftOperator` is moved into `amazon` provider in Airflow 3.0;
|
||||
AIR302_amazon.py:36:1: AIR302 `airflow.operators.s3_to_redshift_operator.S3ToRedshiftOperator` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
19 | RedshiftToS3Operator()
|
||||
20 | S3FileTransformOperator()
|
||||
21 | S3ToRedshiftOperator()
|
||||
34 | S3FileTransformOperator()
|
||||
35 |
|
||||
36 | S3ToRedshiftOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
22 | S3KeySensor()
|
||||
37 | S3ToRedshiftTransfer()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `S3ToRedshiftOperator` from `airflow.providers.amazon.aws.transfers.s3_to_redshift` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Operator
|
||||
9 9 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
|
||||
10 10 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
|
||||
11 |-from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
|
||||
12 11 | from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
12 |+from airflow.providers.amazon.aws.transfers.s3_to_redshift import S3ToRedshiftOperator
|
||||
13 13 |
|
||||
14 14 | S3Hook()
|
||||
15 15 | provide_bucket_name()
|
||||
|
||||
AIR302_amazon.py:22:1: AIR302 [*] `airflow.sensors.s3_key_sensor.S3KeySensor` is moved into `amazon` provider in Airflow 3.0;
|
||||
AIR302_amazon.py:37:1: AIR302 `airflow.operators.s3_to_redshift_operator.S3ToRedshiftTransfer` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
20 | S3FileTransformOperator()
|
||||
21 | S3ToRedshiftOperator()
|
||||
22 | S3KeySensor()
|
||||
36 | S3ToRedshiftOperator()
|
||||
37 | S3ToRedshiftTransfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
38 |
|
||||
39 | S3KeySensor()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `S3ToRedshiftOperator` from `airflow.providers.amazon.aws.transfers.s3_to_redshift` instead.
|
||||
|
||||
AIR302_amazon.py:39:1: AIR302 `airflow.sensors.s3_key_sensor.S3KeySensor` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
37 | S3ToRedshiftTransfer()
|
||||
38 |
|
||||
39 | S3KeySensor()
|
||||
| ^^^^^^^^^^^ AIR302
|
||||
23 |
|
||||
24 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Transfer
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `S3KeySensor` from `airflow.providers.amazon.aws.sensors.s3` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Operator
|
||||
10 10 | from airflow.operators.s3_file_transform_operator import S3FileTransformOperator
|
||||
11 11 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftOperator
|
||||
12 |-from airflow.sensors.s3_key_sensor import S3KeySensor
|
||||
12 |+from airflow.providers.amazon.aws.sensors.s3 import S3KeySensor
|
||||
13 13 |
|
||||
14 14 | S3Hook()
|
||||
15 15 | provide_bucket_name()
|
||||
|
||||
AIR302_amazon.py:26:1: AIR302 [*] `airflow.operators.google_api_to_s3_transfer.GoogleApiToS3Transfer` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
24 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Transfer
|
||||
25 |
|
||||
26 | GoogleApiToS3Transfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
27 |
|
||||
28 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Transfer
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `GoogleApiToS3Operator` from `airflow.providers.amazon.aws.transfers.google_api_to_s3` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
22 22 | S3KeySensor()
|
||||
23 23 |
|
||||
24 24 | from airflow.operators.google_api_to_s3_transfer import GoogleApiToS3Transfer
|
||||
25 |+from airflow.providers.amazon.aws.transfers.google_api_to_s3 import GoogleApiToS3Operator
|
||||
25 26 |
|
||||
26 27 | GoogleApiToS3Transfer()
|
||||
27 28 |
|
||||
|
||||
AIR302_amazon.py:30:1: AIR302 [*] `airflow.operators.redshift_to_s3_operator.RedshiftToS3Transfer` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
28 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Transfer
|
||||
29 |
|
||||
30 | RedshiftToS3Transfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
31 |
|
||||
32 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftTransfer
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `RedshiftToS3Operator` from `airflow.providers.amazon.aws.transfers.redshift_to_s3` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
26 26 | GoogleApiToS3Transfer()
|
||||
27 27 |
|
||||
28 28 | from airflow.operators.redshift_to_s3_operator import RedshiftToS3Transfer
|
||||
29 |+from airflow.providers.amazon.aws.transfers.redshift_to_s3 import RedshiftToS3Operator
|
||||
29 30 |
|
||||
30 31 | RedshiftToS3Transfer()
|
||||
31 32 |
|
||||
|
||||
AIR302_amazon.py:34:1: AIR302 [*] `airflow.operators.s3_to_redshift_operator.S3ToRedshiftTransfer` is moved into `amazon` provider in Airflow 3.0;
|
||||
|
|
||||
32 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftTransfer
|
||||
33 |
|
||||
34 | S3ToRedshiftTransfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-amazon>=1.0.0` and use `S3ToRedshiftOperator` from `airflow.providers.amazon.aws.transfers.s3_to_redshift` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
30 30 | RedshiftToS3Transfer()
|
||||
31 31 |
|
||||
32 32 | from airflow.operators.s3_to_redshift_operator import S3ToRedshiftTransfer
|
||||
33 |+from airflow.providers.amazon.aws.transfers.s3_to_redshift import S3ToRedshiftOperator
|
||||
33 34 |
|
||||
34 35 | S3ToRedshiftTransfer()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR302_celery.py:9:1: AIR302 [*] `airflow.config_templates.default_celery.DEFAULT_CELERY_CONFIG` is moved into `celery` provider in Airflow 3.0;
|
||||
AIR302_celery.py:9:1: AIR302 `airflow.config_templates.default_celery.DEFAULT_CELERY_CONFIG` is moved into `celery` provider in Airflow 3.0;
|
||||
|
|
||||
7 | )
|
||||
8 |
|
||||
@@ -12,20 +12,7 @@ AIR302_celery.py:9:1: AIR302 [*] `airflow.config_templates.default_celery.DEFAUL
|
||||
|
|
||||
= help: Install `apache-airflow-providers-celery>=3.3.0` and use `DEFAULT_CELERY_CONFIG` from `airflow.providers.celery.executors.default_celery` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG
|
||||
4 3 | from airflow.executors.celery_executor import (
|
||||
5 4 | CeleryExecutor,
|
||||
6 5 | app,
|
||||
7 6 | )
|
||||
7 |+from airflow.providers.celery.executors.default_celery import DEFAULT_CELERY_CONFIG
|
||||
8 8 |
|
||||
9 9 | DEFAULT_CELERY_CONFIG
|
||||
10 10 |
|
||||
|
||||
AIR302_celery.py:11:1: AIR302 [*] `airflow.executors.celery_executor.app` is moved into `celery` provider in Airflow 3.0;
|
||||
AIR302_celery.py:11:1: AIR302 `airflow.executors.celery_executor.app` is moved into `celery` provider in Airflow 3.0;
|
||||
|
|
||||
9 | DEFAULT_CELERY_CONFIG
|
||||
10 |
|
||||
@@ -35,33 +22,10 @@ AIR302_celery.py:11:1: AIR302 [*] `airflow.executors.celery_executor.app` is mov
|
||||
|
|
||||
= help: Install `apache-airflow-providers-celery>=3.3.0` and use `app` from `airflow.providers.celery.executors.celery_executor_utils` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG
|
||||
4 4 | from airflow.executors.celery_executor import (
|
||||
5 5 | CeleryExecutor,
|
||||
6 |- app,
|
||||
7 6 | )
|
||||
7 |+from airflow.providers.celery.executors.celery_executor_utils import app
|
||||
8 8 |
|
||||
9 9 | DEFAULT_CELERY_CONFIG
|
||||
10 10 |
|
||||
|
||||
AIR302_celery.py:12:1: AIR302 [*] `airflow.executors.celery_executor.CeleryExecutor` is moved into `celery` provider in Airflow 3.0;
|
||||
AIR302_celery.py:12:1: AIR302 `airflow.executors.celery_executor.CeleryExecutor` is moved into `celery` provider in Airflow 3.0;
|
||||
|
|
||||
11 | app
|
||||
12 | CeleryExecutor()
|
||||
| ^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-celery>=3.3.0` and use `CeleryExecutor` from `airflow.providers.celery.executors.celery_executor` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 | from airflow.config_templates.default_celery import DEFAULT_CELERY_CONFIG
|
||||
4 4 | from airflow.executors.celery_executor import (
|
||||
5 |- CeleryExecutor,
|
||||
6 5 | app,
|
||||
7 6 | )
|
||||
7 |+from airflow.providers.celery.executors.celery_executor import CeleryExecutor
|
||||
8 8 |
|
||||
9 9 | DEFAULT_CELERY_CONFIG
|
||||
10 10 |
|
||||
|
||||
@@ -1,639 +1,290 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR302_common_sql.py:8:1: AIR302 [*] `airflow.hooks.dbapi.ConnectorProtocol` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
6 | )
|
||||
7 |
|
||||
8 | ConnectorProtocol()
|
||||
| ^^^^^^^^^^^^^^^^^ AIR302
|
||||
9 | DbApiHook()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `ConnectorProtocol` from `airflow.providers.common.sql.hooks.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.dbapi import (
|
||||
4 |- ConnectorProtocol,
|
||||
5 4 | DbApiHook,
|
||||
6 5 | )
|
||||
6 |+from airflow.providers.common.sql.hooks.sql import ConnectorProtocol
|
||||
7 7 |
|
||||
8 8 | ConnectorProtocol()
|
||||
9 9 | DbApiHook()
|
||||
|
||||
AIR302_common_sql.py:9:1: AIR302 [*] `airflow.hooks.dbapi.DbApiHook` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:10:1: AIR302 `airflow.hooks.dbapi.ConnectorProtocol` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
8 | ConnectorProtocol()
|
||||
9 | DbApiHook()
|
||||
8 | from airflow.operators.check_operator import SQLCheckOperator
|
||||
9 |
|
||||
10 | ConnectorProtocol()
|
||||
| ^^^^^^^^^^^^^^^^^ AIR302
|
||||
11 | DbApiHook()
|
||||
12 | SQLCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `ConnectorProtocol` from `airflow.providers.common.sql.hooks.sql` instead.
|
||||
|
||||
AIR302_common_sql.py:11:1: AIR302 `airflow.hooks.dbapi_hook.DbApiHook` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
10 | ConnectorProtocol()
|
||||
11 | DbApiHook()
|
||||
| ^^^^^^^^^ AIR302
|
||||
10 |
|
||||
11 | from airflow.hooks.dbapi_hook import DbApiHook
|
||||
12 | SQLCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `DbApiHook` from `airflow.providers.common.sql.hooks.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.dbapi import (
|
||||
4 4 | ConnectorProtocol,
|
||||
5 |- DbApiHook,
|
||||
6 5 | )
|
||||
6 |+from airflow.providers.common.sql.hooks.sql import DbApiHook
|
||||
7 7 |
|
||||
8 8 | ConnectorProtocol()
|
||||
9 9 | DbApiHook()
|
||||
|
||||
AIR302_common_sql.py:14:1: AIR302 [*] `airflow.hooks.dbapi_hook.DbApiHook` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:12:1: AIR302 `airflow.operators.check_operator.SQLCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
12 | from airflow.operators.check_operator import SQLCheckOperator
|
||||
13 |
|
||||
14 | DbApiHook()
|
||||
| ^^^^^^^^^ AIR302
|
||||
15 | SQLCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `DbApiHook` from `airflow.providers.common.sql.hooks.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | ConnectorProtocol()
|
||||
9 9 | DbApiHook()
|
||||
10 10 |
|
||||
11 |-from airflow.hooks.dbapi_hook import DbApiHook
|
||||
12 11 | from airflow.operators.check_operator import SQLCheckOperator
|
||||
12 |+from airflow.providers.common.sql.hooks.sql import DbApiHook
|
||||
13 13 |
|
||||
14 14 | DbApiHook()
|
||||
15 15 | SQLCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:15:1: AIR302 [*] `airflow.operators.check_operator.SQLCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
14 | DbApiHook()
|
||||
15 | SQLCheckOperator()
|
||||
10 | ConnectorProtocol()
|
||||
11 | DbApiHook()
|
||||
12 | SQLCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
9 9 | DbApiHook()
|
||||
10 10 |
|
||||
11 11 | from airflow.hooks.dbapi_hook import DbApiHook
|
||||
12 |-from airflow.operators.check_operator import SQLCheckOperator
|
||||
12 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
|
||||
13 13 |
|
||||
14 14 | DbApiHook()
|
||||
15 15 | SQLCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:21:1: AIR302 [*] `airflow.operators.sql.SQLCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:18:1: AIR302 `airflow.operators.sql.SQLCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
19 | from airflow.operators.sql import SQLCheckOperator
|
||||
20 |
|
||||
21 | SQLCheckOperator()
|
||||
16 | from airflow.operators.sql import SQLCheckOperator
|
||||
17 |
|
||||
18 | SQLCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^ AIR302
|
||||
22 | CheckOperator()
|
||||
19 | CheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
16 16 |
|
||||
17 17 |
|
||||
18 18 | from airflow.operators.check_operator import CheckOperator
|
||||
19 |-from airflow.operators.sql import SQLCheckOperator
|
||||
19 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
|
||||
20 20 |
|
||||
21 21 | SQLCheckOperator()
|
||||
22 22 | CheckOperator()
|
||||
|
||||
AIR302_common_sql.py:22:1: AIR302 [*] `airflow.operators.check_operator.CheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:19:1: AIR302 `airflow.operators.check_operator.CheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
21 | SQLCheckOperator()
|
||||
22 | CheckOperator()
|
||||
18 | SQLCheckOperator()
|
||||
19 | CheckOperator()
|
||||
| ^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 |
|
||||
18 18 | from airflow.operators.check_operator import CheckOperator
|
||||
19 19 | from airflow.operators.sql import SQLCheckOperator
|
||||
20 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
|
||||
20 21 |
|
||||
21 22 | SQLCheckOperator()
|
||||
22 23 | CheckOperator()
|
||||
|
||||
AIR302_common_sql.py:27:1: AIR302 [*] `airflow.operators.druid_check_operator.CheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:24:1: AIR302 `airflow.operators.druid_check_operator.CheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
25 | from airflow.operators.druid_check_operator import CheckOperator
|
||||
26 |
|
||||
27 | CheckOperator()
|
||||
22 | from airflow.operators.druid_check_operator import CheckOperator
|
||||
23 |
|
||||
24 | CheckOperator()
|
||||
| ^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
23 23 |
|
||||
24 24 |
|
||||
25 25 | from airflow.operators.druid_check_operator import CheckOperator
|
||||
26 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
|
||||
26 27 |
|
||||
27 28 | CheckOperator()
|
||||
28 29 |
|
||||
|
||||
AIR302_common_sql.py:32:1: AIR302 [*] `airflow.operators.presto_check_operator.CheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:29:1: AIR302 `airflow.operators.presto_check_operator.CheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
30 | from airflow.operators.presto_check_operator import CheckOperator
|
||||
31 |
|
||||
32 | CheckOperator()
|
||||
27 | from airflow.operators.presto_check_operator import CheckOperator
|
||||
28 |
|
||||
29 | CheckOperator()
|
||||
| ^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
28 28 |
|
||||
29 29 |
|
||||
30 30 | from airflow.operators.presto_check_operator import CheckOperator
|
||||
31 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
|
||||
31 32 |
|
||||
32 33 | CheckOperator()
|
||||
33 34 |
|
||||
|
||||
AIR302_common_sql.py:42:1: AIR302 [*] `airflow.operators.druid_check_operator.DruidCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:39:1: AIR302 `airflow.operators.druid_check_operator.DruidCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
40 | from airflow.operators.presto_check_operator import PrestoCheckOperator
|
||||
41 |
|
||||
42 | DruidCheckOperator()
|
||||
37 | from airflow.operators.presto_check_operator import PrestoCheckOperator
|
||||
38 |
|
||||
39 | DruidCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR302
|
||||
43 | PrestoCheckOperator()
|
||||
44 | IntervalCheckOperator()
|
||||
40 | PrestoCheckOperator()
|
||||
41 | IntervalCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
38 38 | )
|
||||
39 39 | from airflow.operators.druid_check_operator import DruidCheckOperator
|
||||
40 40 | from airflow.operators.presto_check_operator import PrestoCheckOperator
|
||||
41 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
|
||||
41 42 |
|
||||
42 43 | DruidCheckOperator()
|
||||
43 44 | PrestoCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:43:1: AIR302 [*] `airflow.operators.presto_check_operator.PrestoCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:40:1: AIR302 `airflow.operators.presto_check_operator.PrestoCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
42 | DruidCheckOperator()
|
||||
43 | PrestoCheckOperator()
|
||||
39 | DruidCheckOperator()
|
||||
40 | PrestoCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
44 | IntervalCheckOperator()
|
||||
45 | SQLIntervalCheckOperator()
|
||||
41 | IntervalCheckOperator()
|
||||
42 | SQLIntervalCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
38 38 | )
|
||||
39 39 | from airflow.operators.druid_check_operator import DruidCheckOperator
|
||||
40 40 | from airflow.operators.presto_check_operator import PrestoCheckOperator
|
||||
41 |+from airflow.providers.common.sql.operators.sql import SQLCheckOperator
|
||||
41 42 |
|
||||
42 43 | DruidCheckOperator()
|
||||
43 44 | PrestoCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:44:1: AIR302 [*] `airflow.operators.check_operator.IntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:41:1: AIR302 `airflow.operators.check_operator.IntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
42 | DruidCheckOperator()
|
||||
43 | PrestoCheckOperator()
|
||||
44 | IntervalCheckOperator()
|
||||
39 | DruidCheckOperator()
|
||||
40 | PrestoCheckOperator()
|
||||
41 | IntervalCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
45 | SQLIntervalCheckOperator()
|
||||
42 | SQLIntervalCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLIntervalCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
34 34 |
|
||||
35 35 | from airflow.operators.check_operator import (
|
||||
36 36 | IntervalCheckOperator,
|
||||
37 |- SQLIntervalCheckOperator,
|
||||
38 37 | )
|
||||
39 38 | from airflow.operators.druid_check_operator import DruidCheckOperator
|
||||
40 39 | from airflow.operators.presto_check_operator import PrestoCheckOperator
|
||||
40 |+from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
|
||||
41 41 |
|
||||
42 42 | DruidCheckOperator()
|
||||
43 43 | PrestoCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:45:1: AIR302 [*] `airflow.operators.check_operator.SQLIntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:42:1: AIR302 `airflow.operators.check_operator.SQLIntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
43 | PrestoCheckOperator()
|
||||
44 | IntervalCheckOperator()
|
||||
45 | SQLIntervalCheckOperator()
|
||||
40 | PrestoCheckOperator()
|
||||
41 | IntervalCheckOperator()
|
||||
42 | SQLIntervalCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLIntervalCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
34 34 |
|
||||
35 35 | from airflow.operators.check_operator import (
|
||||
36 36 | IntervalCheckOperator,
|
||||
37 |- SQLIntervalCheckOperator,
|
||||
38 37 | )
|
||||
39 38 | from airflow.operators.druid_check_operator import DruidCheckOperator
|
||||
40 39 | from airflow.operators.presto_check_operator import PrestoCheckOperator
|
||||
40 |+from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
|
||||
41 41 |
|
||||
42 42 | DruidCheckOperator()
|
||||
43 43 | PrestoCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:54:1: AIR302 [*] `airflow.operators.presto_check_operator.IntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:51:1: AIR302 `airflow.operators.presto_check_operator.IntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
52 | from airflow.operators.sql import SQLIntervalCheckOperator
|
||||
53 |
|
||||
54 | IntervalCheckOperator()
|
||||
49 | from airflow.operators.sql import SQLIntervalCheckOperator
|
||||
50 |
|
||||
51 | IntervalCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
55 | SQLIntervalCheckOperator()
|
||||
56 | PrestoIntervalCheckOperator()
|
||||
52 | SQLIntervalCheckOperator()
|
||||
53 | PrestoIntervalCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLIntervalCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
50 50 | PrestoIntervalCheckOperator,
|
||||
51 51 | )
|
||||
52 52 | from airflow.operators.sql import SQLIntervalCheckOperator
|
||||
53 |+from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
|
||||
53 54 |
|
||||
54 55 | IntervalCheckOperator()
|
||||
55 56 | SQLIntervalCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:55:1: AIR302 [*] `airflow.operators.sql.SQLIntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:52:1: AIR302 `airflow.operators.sql.SQLIntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
54 | IntervalCheckOperator()
|
||||
55 | SQLIntervalCheckOperator()
|
||||
51 | IntervalCheckOperator()
|
||||
52 | SQLIntervalCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
56 | PrestoIntervalCheckOperator()
|
||||
53 | PrestoIntervalCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLIntervalCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
49 49 | IntervalCheckOperator,
|
||||
50 50 | PrestoIntervalCheckOperator,
|
||||
51 51 | )
|
||||
52 |-from airflow.operators.sql import SQLIntervalCheckOperator
|
||||
52 |+from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
|
||||
53 53 |
|
||||
54 54 | IntervalCheckOperator()
|
||||
55 55 | SQLIntervalCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:56:1: AIR302 [*] `airflow.operators.presto_check_operator.PrestoIntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:53:1: AIR302 `airflow.operators.presto_check_operator.PrestoIntervalCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
54 | IntervalCheckOperator()
|
||||
55 | SQLIntervalCheckOperator()
|
||||
56 | PrestoIntervalCheckOperator()
|
||||
51 | IntervalCheckOperator()
|
||||
52 | SQLIntervalCheckOperator()
|
||||
53 | PrestoIntervalCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLIntervalCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
50 50 | PrestoIntervalCheckOperator,
|
||||
51 51 | )
|
||||
52 52 | from airflow.operators.sql import SQLIntervalCheckOperator
|
||||
53 |+from airflow.providers.common.sql.operators.sql import SQLIntervalCheckOperator
|
||||
53 54 |
|
||||
54 55 | IntervalCheckOperator()
|
||||
55 56 | SQLIntervalCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:64:1: AIR302 [*] `airflow.operators.check_operator.SQLThresholdCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:61:1: AIR302 `airflow.operators.check_operator.SQLThresholdCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
62 | )
|
||||
63 |
|
||||
64 | SQLThresholdCheckOperator()
|
||||
59 | )
|
||||
60 |
|
||||
61 | SQLThresholdCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
65 | ThresholdCheckOperator()
|
||||
62 | ThresholdCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLThresholdCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
57 57 |
|
||||
58 58 |
|
||||
59 59 | from airflow.operators.check_operator import (
|
||||
60 |- SQLThresholdCheckOperator,
|
||||
61 60 | ThresholdCheckOperator,
|
||||
62 61 | )
|
||||
62 |+from airflow.providers.common.sql.operators.sql import SQLThresholdCheckOperator
|
||||
63 63 |
|
||||
64 64 | SQLThresholdCheckOperator()
|
||||
65 65 | ThresholdCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:65:1: AIR302 [*] `airflow.operators.check_operator.ThresholdCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:62:1: AIR302 `airflow.operators.check_operator.ThresholdCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
64 | SQLThresholdCheckOperator()
|
||||
65 | ThresholdCheckOperator()
|
||||
61 | SQLThresholdCheckOperator()
|
||||
62 | ThresholdCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLThresholdCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
57 57 |
|
||||
58 58 |
|
||||
59 59 | from airflow.operators.check_operator import (
|
||||
60 |- SQLThresholdCheckOperator,
|
||||
61 60 | ThresholdCheckOperator,
|
||||
62 61 | )
|
||||
62 |+from airflow.providers.common.sql.operators.sql import SQLThresholdCheckOperator
|
||||
63 63 |
|
||||
64 64 | SQLThresholdCheckOperator()
|
||||
65 65 | ThresholdCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:70:1: AIR302 [*] `airflow.operators.sql.SQLThresholdCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:67:1: AIR302 `airflow.operators.sql.SQLThresholdCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
68 | from airflow.operators.sql import SQLThresholdCheckOperator
|
||||
69 |
|
||||
70 | SQLThresholdCheckOperator()
|
||||
65 | from airflow.operators.sql import SQLThresholdCheckOperator
|
||||
66 |
|
||||
67 | SQLThresholdCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLThresholdCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
65 65 | ThresholdCheckOperator()
|
||||
66 66 |
|
||||
67 67 |
|
||||
68 |-from airflow.operators.sql import SQLThresholdCheckOperator
|
||||
68 |+from airflow.providers.common.sql.operators.sql import SQLThresholdCheckOperator
|
||||
69 69 |
|
||||
70 70 | SQLThresholdCheckOperator()
|
||||
71 71 |
|
||||
|
||||
AIR302_common_sql.py:78:1: AIR302 [*] `airflow.operators.check_operator.SQLValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:75:1: AIR302 `airflow.operators.check_operator.SQLValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
76 | )
|
||||
77 |
|
||||
78 | SQLValueCheckOperator()
|
||||
73 | )
|
||||
74 |
|
||||
75 | SQLValueCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
79 | ValueCheckOperator()
|
||||
76 | ValueCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLValueCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
71 71 |
|
||||
72 72 |
|
||||
73 73 | from airflow.operators.check_operator import (
|
||||
74 |- SQLValueCheckOperator,
|
||||
75 74 | ValueCheckOperator,
|
||||
76 75 | )
|
||||
76 |+from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
|
||||
77 77 |
|
||||
78 78 | SQLValueCheckOperator()
|
||||
79 79 | ValueCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:79:1: AIR302 [*] `airflow.operators.check_operator.ValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:76:1: AIR302 `airflow.operators.check_operator.ValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
78 | SQLValueCheckOperator()
|
||||
79 | ValueCheckOperator()
|
||||
75 | SQLValueCheckOperator()
|
||||
76 | ValueCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLValueCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
71 71 |
|
||||
72 72 |
|
||||
73 73 | from airflow.operators.check_operator import (
|
||||
74 |- SQLValueCheckOperator,
|
||||
75 74 | ValueCheckOperator,
|
||||
76 75 | )
|
||||
76 |+from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
|
||||
77 77 |
|
||||
78 78 | SQLValueCheckOperator()
|
||||
79 79 | ValueCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:88:1: AIR302 [*] `airflow.operators.sql.SQLValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:85:1: AIR302 `airflow.operators.sql.SQLValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
86 | from airflow.operators.sql import SQLValueCheckOperator
|
||||
87 |
|
||||
88 | SQLValueCheckOperator()
|
||||
83 | from airflow.operators.sql import SQLValueCheckOperator
|
||||
84 |
|
||||
85 | SQLValueCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
89 | ValueCheckOperator()
|
||||
90 | PrestoValueCheckOperator()
|
||||
86 | ValueCheckOperator()
|
||||
87 | PrestoValueCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLValueCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
83 83 | PrestoValueCheckOperator,
|
||||
84 84 | ValueCheckOperator,
|
||||
85 85 | )
|
||||
86 |-from airflow.operators.sql import SQLValueCheckOperator
|
||||
86 |+from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
|
||||
87 87 |
|
||||
88 88 | SQLValueCheckOperator()
|
||||
89 89 | ValueCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:89:1: AIR302 [*] `airflow.operators.presto_check_operator.ValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:86:1: AIR302 `airflow.operators.presto_check_operator.ValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
88 | SQLValueCheckOperator()
|
||||
89 | ValueCheckOperator()
|
||||
85 | SQLValueCheckOperator()
|
||||
86 | ValueCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^ AIR302
|
||||
90 | PrestoValueCheckOperator()
|
||||
87 | PrestoValueCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLValueCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
84 84 | ValueCheckOperator,
|
||||
85 85 | )
|
||||
86 86 | from airflow.operators.sql import SQLValueCheckOperator
|
||||
87 |+from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
|
||||
87 88 |
|
||||
88 89 | SQLValueCheckOperator()
|
||||
89 90 | ValueCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:90:1: AIR302 [*] `airflow.operators.presto_check_operator.PrestoValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:87:1: AIR302 `airflow.operators.presto_check_operator.PrestoValueCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
88 | SQLValueCheckOperator()
|
||||
89 | ValueCheckOperator()
|
||||
90 | PrestoValueCheckOperator()
|
||||
85 | SQLValueCheckOperator()
|
||||
86 | ValueCheckOperator()
|
||||
87 | PrestoValueCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLValueCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
84 84 | ValueCheckOperator,
|
||||
85 85 | )
|
||||
86 86 | from airflow.operators.sql import SQLValueCheckOperator
|
||||
87 |+from airflow.providers.common.sql.operators.sql import SQLValueCheckOperator
|
||||
87 88 |
|
||||
88 89 | SQLValueCheckOperator()
|
||||
89 90 | ValueCheckOperator()
|
||||
|
||||
AIR302_common_sql.py:102:1: AIR302 [*] `airflow.operators.sql.BaseSQLOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:99:1: AIR302 `airflow.operators.sql.BaseSQLOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
100 | )
|
||||
101 |
|
||||
102 | BaseSQLOperator()
|
||||
97 | )
|
||||
98 |
|
||||
99 | BaseSQLOperator()
|
||||
| ^^^^^^^^^^^^^^^ AIR302
|
||||
103 | BranchSQLOperator()
|
||||
104 | SQLTableCheckOperator()
|
||||
100 | BranchSQLOperator()
|
||||
101 | SQLTableCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `BaseSQLOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
91 91 |
|
||||
92 92 |
|
||||
93 93 | from airflow.operators.sql import (
|
||||
94 |- BaseSQLOperator,
|
||||
95 94 | BranchSQLOperator,
|
||||
96 95 | SQLColumnCheckOperator,
|
||||
97 96 | SQLTableCheckOperator,
|
||||
98 97 | _convert_to_float_if_possible,
|
||||
99 98 | parse_boolean,
|
||||
100 99 | )
|
||||
100 |+from airflow.providers.common.sql.operators.sql import BaseSQLOperator
|
||||
101 101 |
|
||||
102 102 | BaseSQLOperator()
|
||||
103 103 | BranchSQLOperator()
|
||||
|
||||
AIR302_common_sql.py:103:1: AIR302 [*] `airflow.operators.sql.BranchSQLOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:100:1: AIR302 `airflow.operators.sql.BranchSQLOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
102 | BaseSQLOperator()
|
||||
103 | BranchSQLOperator()
|
||||
99 | BaseSQLOperator()
|
||||
100 | BranchSQLOperator()
|
||||
| ^^^^^^^^^^^^^^^^^ AIR302
|
||||
104 | SQLTableCheckOperator()
|
||||
105 | SQLColumnCheckOperator()
|
||||
101 | SQLTableCheckOperator()
|
||||
102 | SQLColumnCheckOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `BranchSQLOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
92 92 |
|
||||
93 93 | from airflow.operators.sql import (
|
||||
94 94 | BaseSQLOperator,
|
||||
95 |- BranchSQLOperator,
|
||||
96 95 | SQLColumnCheckOperator,
|
||||
97 96 | SQLTableCheckOperator,
|
||||
98 97 | _convert_to_float_if_possible,
|
||||
99 98 | parse_boolean,
|
||||
100 99 | )
|
||||
100 |+from airflow.providers.common.sql.operators.sql import BranchSQLOperator
|
||||
101 101 |
|
||||
102 102 | BaseSQLOperator()
|
||||
103 103 | BranchSQLOperator()
|
||||
|
||||
AIR302_common_sql.py:104:1: AIR302 [*] `airflow.operators.sql.SQLTableCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:101:1: AIR302 `airflow.operators.sql.SQLTableCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
102 | BaseSQLOperator()
|
||||
103 | BranchSQLOperator()
|
||||
104 | SQLTableCheckOperator()
|
||||
99 | BaseSQLOperator()
|
||||
100 | BranchSQLOperator()
|
||||
101 | SQLTableCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
105 | SQLColumnCheckOperator()
|
||||
106 | _convert_to_float_if_possible()
|
||||
102 | SQLColumnCheckOperator()
|
||||
103 | _convert_to_float_if_possible()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.1.0` and use `SQLTableCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
94 94 | BaseSQLOperator,
|
||||
95 95 | BranchSQLOperator,
|
||||
96 96 | SQLColumnCheckOperator,
|
||||
97 |- SQLTableCheckOperator,
|
||||
98 97 | _convert_to_float_if_possible,
|
||||
99 98 | parse_boolean,
|
||||
100 99 | )
|
||||
100 |+from airflow.providers.common.sql.operators.sql import SQLTableCheckOperator
|
||||
101 101 |
|
||||
102 102 | BaseSQLOperator()
|
||||
103 103 | BranchSQLOperator()
|
||||
|
||||
AIR302_common_sql.py:105:1: AIR302 [*] `airflow.operators.sql.SQLColumnCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:102:1: AIR302 `airflow.operators.sql.SQLColumnCheckOperator` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
103 | BranchSQLOperator()
|
||||
104 | SQLTableCheckOperator()
|
||||
105 | SQLColumnCheckOperator()
|
||||
100 | BranchSQLOperator()
|
||||
101 | SQLTableCheckOperator()
|
||||
102 | SQLColumnCheckOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
106 | _convert_to_float_if_possible()
|
||||
107 | parse_boolean()
|
||||
103 | _convert_to_float_if_possible()
|
||||
104 | parse_boolean()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `SQLColumnCheckOperator` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
93 93 | from airflow.operators.sql import (
|
||||
94 94 | BaseSQLOperator,
|
||||
95 95 | BranchSQLOperator,
|
||||
96 |- SQLColumnCheckOperator,
|
||||
97 96 | SQLTableCheckOperator,
|
||||
98 97 | _convert_to_float_if_possible,
|
||||
99 98 | parse_boolean,
|
||||
100 99 | )
|
||||
100 |+from airflow.providers.common.sql.operators.sql import SQLColumnCheckOperator
|
||||
101 101 |
|
||||
102 102 | BaseSQLOperator()
|
||||
103 103 | BranchSQLOperator()
|
||||
|
||||
AIR302_common_sql.py:106:1: AIR302 [*] `airflow.operators.sql._convert_to_float_if_possible` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:103:1: AIR302 `airflow.operators.sql._convert_to_float_if_possible` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
104 | SQLTableCheckOperator()
|
||||
105 | SQLColumnCheckOperator()
|
||||
106 | _convert_to_float_if_possible()
|
||||
101 | SQLTableCheckOperator()
|
||||
102 | SQLColumnCheckOperator()
|
||||
103 | _convert_to_float_if_possible()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
107 | parse_boolean()
|
||||
104 | parse_boolean()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `_convert_to_float_if_possible` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
95 95 | BranchSQLOperator,
|
||||
96 96 | SQLColumnCheckOperator,
|
||||
97 97 | SQLTableCheckOperator,
|
||||
98 |- _convert_to_float_if_possible,
|
||||
99 98 | parse_boolean,
|
||||
100 99 | )
|
||||
100 |+from airflow.providers.common.sql.operators.sql import _convert_to_float_if_possible
|
||||
101 101 |
|
||||
102 102 | BaseSQLOperator()
|
||||
103 103 | BranchSQLOperator()
|
||||
|
||||
AIR302_common_sql.py:107:1: AIR302 [*] `airflow.operators.sql.parse_boolean` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:104:1: AIR302 `airflow.operators.sql.parse_boolean` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
105 | SQLColumnCheckOperator()
|
||||
106 | _convert_to_float_if_possible()
|
||||
107 | parse_boolean()
|
||||
102 | SQLColumnCheckOperator()
|
||||
103 | _convert_to_float_if_possible()
|
||||
104 | parse_boolean()
|
||||
| ^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `parse_boolean` from `airflow.providers.common.sql.operators.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
96 96 | SQLColumnCheckOperator,
|
||||
97 97 | SQLTableCheckOperator,
|
||||
98 98 | _convert_to_float_if_possible,
|
||||
99 |- parse_boolean,
|
||||
100 99 | )
|
||||
100 |+from airflow.providers.common.sql.operators.sql import parse_boolean
|
||||
101 101 |
|
||||
102 102 | BaseSQLOperator()
|
||||
103 103 | BranchSQLOperator()
|
||||
|
||||
AIR302_common_sql.py:112:1: AIR302 [*] `airflow.sensors.sql.SqlSensor` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:109:1: AIR302 `airflow.sensors.sql.SqlSensor` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
110 | from airflow.sensors.sql import SqlSensor
|
||||
111 |
|
||||
112 | SqlSensor()
|
||||
107 | from airflow.sensors.sql import SqlSensor
|
||||
108 |
|
||||
109 | SqlSensor()
|
||||
| ^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `SqlSensor` from `airflow.providers.common.sql.sensors.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
107 107 | parse_boolean()
|
||||
108 108 |
|
||||
109 109 |
|
||||
110 |-from airflow.sensors.sql import SqlSensor
|
||||
110 |+from airflow.providers.common.sql.sensors.sql import SqlSensor
|
||||
111 111 |
|
||||
112 112 | SqlSensor()
|
||||
113 113 |
|
||||
|
||||
AIR302_common_sql.py:117:1: AIR302 [*] `airflow.sensors.sql_sensor.SqlSensor` is moved into `common-sql` provider in Airflow 3.0;
|
||||
AIR302_common_sql.py:114:1: AIR302 `airflow.sensors.sql_sensor.SqlSensor` is moved into `common-sql` provider in Airflow 3.0;
|
||||
|
|
||||
115 | from airflow.sensors.sql_sensor import SqlSensor
|
||||
116 |
|
||||
117 | SqlSensor()
|
||||
112 | from airflow.sensors.sql_sensor import SqlSensor
|
||||
113 |
|
||||
114 | SqlSensor()
|
||||
| ^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-common-sql>=1.0.0` and use `SqlSensor` from `airflow.providers.common.sql.sensors.sql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
112 112 | SqlSensor()
|
||||
113 113 |
|
||||
114 114 |
|
||||
115 |-from airflow.sensors.sql_sensor import SqlSensor
|
||||
115 |+from airflow.providers.common.sql.sensors.sql import SqlSensor
|
||||
116 116 |
|
||||
117 117 | SqlSensor()
|
||||
118 118 |
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR302_daskexecutor.py:5:1: AIR302 [*] `airflow.executors.dask_executor.DaskExecutor` is moved into `daskexecutor` provider in Airflow 3.0;
|
||||
AIR302_daskexecutor.py:5:1: AIR302 `airflow.executors.dask_executor.DaskExecutor` is moved into `daskexecutor` provider in Airflow 3.0;
|
||||
|
|
||||
3 | from airflow.executors.dask_executor import DaskExecutor
|
||||
4 |
|
||||
@@ -9,11 +9,3 @@ AIR302_daskexecutor.py:5:1: AIR302 [*] `airflow.executors.dask_executor.DaskExec
|
||||
| ^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-daskexecutor>=1.0.0` and use `DaskExecutor` from `airflow.providers.daskexecutor.executors.dask_executor` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.executors.dask_executor import DaskExecutor
|
||||
3 |+from airflow.providers.daskexecutor.executors.dask_executor import DaskExecutor
|
||||
4 4 |
|
||||
5 5 | DaskExecutor()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR302_druid.py:12:1: AIR302 [*] `airflow.hooks.druid_hook.DruidDbApiHook` is moved into `apache-druid` provider in Airflow 3.0;
|
||||
AIR302_druid.py:12:1: AIR302 `airflow.hooks.druid_hook.DruidDbApiHook` is moved into `apache-druid` provider in Airflow 3.0;
|
||||
|
|
||||
10 | )
|
||||
11 |
|
||||
@@ -11,23 +11,7 @@ AIR302_druid.py:12:1: AIR302 [*] `airflow.hooks.druid_hook.DruidDbApiHook` is mo
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-druid>=1.0.0` and use `DruidDbApiHook` from `airflow.providers.apache.druid.hooks.druid` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.druid_hook import (
|
||||
4 |- DruidDbApiHook,
|
||||
5 4 | DruidHook,
|
||||
6 5 | )
|
||||
7 6 | from airflow.operators.hive_to_druid import (
|
||||
8 7 | HiveToDruidOperator,
|
||||
9 8 | HiveToDruidTransfer,
|
||||
10 9 | )
|
||||
10 |+from airflow.providers.apache.druid.hooks.druid import DruidDbApiHook
|
||||
11 11 |
|
||||
12 12 | DruidDbApiHook()
|
||||
13 13 | DruidHook()
|
||||
|
||||
AIR302_druid.py:13:1: AIR302 [*] `airflow.hooks.druid_hook.DruidHook` is moved into `apache-druid` provider in Airflow 3.0;
|
||||
AIR302_druid.py:13:1: AIR302 `airflow.hooks.druid_hook.DruidHook` is moved into `apache-druid` provider in Airflow 3.0;
|
||||
|
|
||||
12 | DruidDbApiHook()
|
||||
13 | DruidHook()
|
||||
@@ -37,22 +21,7 @@ AIR302_druid.py:13:1: AIR302 [*] `airflow.hooks.druid_hook.DruidHook` is moved i
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-druid>=1.0.0` and use `DruidHook` from `airflow.providers.apache.druid.hooks.druid` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.druid_hook import (
|
||||
4 4 | DruidDbApiHook,
|
||||
5 |- DruidHook,
|
||||
6 5 | )
|
||||
7 6 | from airflow.operators.hive_to_druid import (
|
||||
8 7 | HiveToDruidOperator,
|
||||
9 8 | HiveToDruidTransfer,
|
||||
10 9 | )
|
||||
10 |+from airflow.providers.apache.druid.hooks.druid import DruidHook
|
||||
11 11 |
|
||||
12 12 | DruidDbApiHook()
|
||||
13 13 | DruidHook()
|
||||
|
||||
AIR302_druid.py:15:1: AIR302 [*] `airflow.operators.hive_to_druid.HiveToDruidOperator` is moved into `apache-druid` provider in Airflow 3.0;
|
||||
AIR302_druid.py:15:1: AIR302 `airflow.operators.hive_to_druid.HiveToDruidOperator` is moved into `apache-druid` provider in Airflow 3.0;
|
||||
|
|
||||
13 | DruidHook()
|
||||
14 |
|
||||
@@ -62,34 +31,10 @@ AIR302_druid.py:15:1: AIR302 [*] `airflow.operators.hive_to_druid.HiveToDruidOpe
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-druid>=1.0.0` and use `HiveToDruidOperator` from `airflow.providers.apache.druid.transfers.hive_to_druid` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | DruidHook,
|
||||
6 6 | )
|
||||
7 7 | from airflow.operators.hive_to_druid import (
|
||||
8 |- HiveToDruidOperator,
|
||||
9 8 | HiveToDruidTransfer,
|
||||
10 9 | )
|
||||
10 |+from airflow.providers.apache.druid.transfers.hive_to_druid import HiveToDruidOperator
|
||||
11 11 |
|
||||
12 12 | DruidDbApiHook()
|
||||
13 13 | DruidHook()
|
||||
|
||||
AIR302_druid.py:16:1: AIR302 [*] `airflow.operators.hive_to_druid.HiveToDruidTransfer` is moved into `apache-druid` provider in Airflow 3.0;
|
||||
AIR302_druid.py:16:1: AIR302 `airflow.operators.hive_to_druid.HiveToDruidTransfer` is moved into `apache-druid` provider in Airflow 3.0;
|
||||
|
|
||||
15 | HiveToDruidOperator()
|
||||
16 | HiveToDruidTransfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-druid>=1.0.0` and use `HiveToDruidOperator` from `airflow.providers.apache.druid.transfers.hive_to_druid` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
5 5 | DruidHook,
|
||||
6 6 | )
|
||||
7 7 | from airflow.operators.hive_to_druid import (
|
||||
8 |- HiveToDruidOperator,
|
||||
9 8 | HiveToDruidTransfer,
|
||||
10 9 | )
|
||||
10 |+from airflow.providers.apache.druid.transfers.hive_to_druid import HiveToDruidOperator
|
||||
11 11 |
|
||||
12 12 | DruidDbApiHook()
|
||||
13 13 | DruidHook()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR302_fab.py:10:1: AIR302 [*] `airflow.api.auth.backend.basic_auth.CLIENT_AUTH` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:10:1: AIR302 `airflow.api.auth.backend.basic_auth.CLIENT_AUTH` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
8 | )
|
||||
9 |
|
||||
@@ -12,21 +12,7 @@ AIR302_fab.py:10:1: AIR302 [*] `airflow.api.auth.backend.basic_auth.CLIENT_AUTH`
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `CLIENT_AUTH` from `airflow.providers.fab.auth_manager.api.auth.backend.basic_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 3 | from airflow.api.auth.backend.basic_auth import (
|
||||
4 |- CLIENT_AUTH,
|
||||
5 4 | auth_current_user,
|
||||
6 5 | init_app,
|
||||
7 6 | requires_authentication,
|
||||
8 7 | )
|
||||
8 |+from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import CLIENT_AUTH
|
||||
9 9 |
|
||||
10 10 | CLIENT_AUTH
|
||||
11 11 | init_app()
|
||||
|
||||
AIR302_fab.py:11:1: AIR302 [*] `airflow.api.auth.backend.basic_auth.init_app` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:11:1: AIR302 `airflow.api.auth.backend.basic_auth.init_app` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
10 | CLIENT_AUTH
|
||||
11 | init_app()
|
||||
@@ -36,19 +22,7 @@ AIR302_fab.py:11:1: AIR302 [*] `airflow.api.auth.backend.basic_auth.init_app` is
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `init_app` from `airflow.providers.fab.auth_manager.api.auth.backend.basic_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | from airflow.api.auth.backend.basic_auth import (
|
||||
4 4 | CLIENT_AUTH,
|
||||
5 5 | auth_current_user,
|
||||
6 |- init_app,
|
||||
7 6 | requires_authentication,
|
||||
8 7 | )
|
||||
8 |+from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import init_app
|
||||
9 9 |
|
||||
10 10 | CLIENT_AUTH
|
||||
11 11 | init_app()
|
||||
|
||||
AIR302_fab.py:12:1: AIR302 [*] `airflow.api.auth.backend.basic_auth.auth_current_user` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:12:1: AIR302 `airflow.api.auth.backend.basic_auth.auth_current_user` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
10 | CLIENT_AUTH
|
||||
11 | init_app()
|
||||
@@ -58,20 +32,7 @@ AIR302_fab.py:12:1: AIR302 [*] `airflow.api.auth.backend.basic_auth.auth_current
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `auth_current_user` from `airflow.providers.fab.auth_manager.api.auth.backend.basic_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 | from airflow.api.auth.backend.basic_auth import (
|
||||
4 4 | CLIENT_AUTH,
|
||||
5 |- auth_current_user,
|
||||
6 5 | init_app,
|
||||
7 6 | requires_authentication,
|
||||
8 7 | )
|
||||
8 |+from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import auth_current_user
|
||||
9 9 |
|
||||
10 10 | CLIENT_AUTH
|
||||
11 11 | init_app()
|
||||
|
||||
AIR302_fab.py:13:1: AIR302 [*] `airflow.api.auth.backend.basic_auth.requires_authentication` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:13:1: AIR302 `airflow.api.auth.backend.basic_auth.requires_authentication` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
11 | init_app()
|
||||
12 | auth_current_user()
|
||||
@@ -82,18 +43,7 @@ AIR302_fab.py:13:1: AIR302 [*] `airflow.api.auth.backend.basic_auth.requires_aut
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `requires_authentication` from `airflow.providers.fab.auth_manager.api.auth.backend.basic_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | CLIENT_AUTH,
|
||||
5 5 | auth_current_user,
|
||||
6 6 | init_app,
|
||||
7 |- requires_authentication,
|
||||
8 7 | )
|
||||
8 |+from airflow.providers.fab.auth_manager.api.auth.backend.basic_auth import requires_authentication
|
||||
9 9 |
|
||||
10 10 | CLIENT_AUTH
|
||||
11 11 | init_app()
|
||||
|
||||
AIR302_fab.py:23:1: AIR302 [*] `airflow.api.auth.backend.kerberos_auth.log` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:23:1: AIR302 `airflow.api.auth.backend.kerberos_auth.log` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
21 | )
|
||||
22 |
|
||||
@@ -104,19 +54,7 @@ AIR302_fab.py:23:1: AIR302 [*] `airflow.api.auth.backend.kerberos_auth.log` is m
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `log` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
16 16 | CLIENT_AUTH,
|
||||
17 17 | find_user,
|
||||
18 18 | init_app,
|
||||
19 |- log,
|
||||
20 19 | requires_authentication,
|
||||
21 20 | )
|
||||
21 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import log
|
||||
22 22 |
|
||||
23 23 | log()
|
||||
24 24 | CLIENT_AUTH
|
||||
|
||||
AIR302_fab.py:24:1: AIR302 [*] `airflow.api.auth.backend.kerberos_auth.CLIENT_AUTH` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:24:1: AIR302 `airflow.api.auth.backend.kerberos_auth.CLIENT_AUTH` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
23 | log()
|
||||
24 | CLIENT_AUTH
|
||||
@@ -126,22 +64,7 @@ AIR302_fab.py:24:1: AIR302 [*] `airflow.api.auth.backend.kerberos_auth.CLIENT_AU
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `CLIENT_AUTH` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 | requires_authentication()
|
||||
14 14 |
|
||||
15 15 | from airflow.api.auth.backend.kerberos_auth import (
|
||||
16 |- CLIENT_AUTH,
|
||||
17 16 | find_user,
|
||||
18 17 | init_app,
|
||||
19 18 | log,
|
||||
20 19 | requires_authentication,
|
||||
21 20 | )
|
||||
21 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import CLIENT_AUTH
|
||||
22 22 |
|
||||
23 23 | log()
|
||||
24 24 | CLIENT_AUTH
|
||||
|
||||
AIR302_fab.py:25:1: AIR302 [*] `airflow.api.auth.backend.kerberos_auth.find_user` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:25:1: AIR302 `airflow.api.auth.backend.kerberos_auth.find_user` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
23 | log()
|
||||
24 | CLIENT_AUTH
|
||||
@@ -152,21 +75,7 @@ AIR302_fab.py:25:1: AIR302 [*] `airflow.api.auth.backend.kerberos_auth.find_user
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `find_user` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
14 14 |
|
||||
15 15 | from airflow.api.auth.backend.kerberos_auth import (
|
||||
16 16 | CLIENT_AUTH,
|
||||
17 |- find_user,
|
||||
18 17 | init_app,
|
||||
19 18 | log,
|
||||
20 19 | requires_authentication,
|
||||
21 20 | )
|
||||
21 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import find_user
|
||||
22 22 |
|
||||
23 23 | log()
|
||||
24 24 | CLIENT_AUTH
|
||||
|
||||
AIR302_fab.py:26:1: AIR302 [*] `airflow.api.auth.backend.kerberos_auth.init_app` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:26:1: AIR302 `airflow.api.auth.backend.kerberos_auth.init_app` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
24 | CLIENT_AUTH
|
||||
25 | find_user()
|
||||
@@ -176,20 +85,7 @@ AIR302_fab.py:26:1: AIR302 [*] `airflow.api.auth.backend.kerberos_auth.init_app`
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `init_app` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
15 15 | from airflow.api.auth.backend.kerberos_auth import (
|
||||
16 16 | CLIENT_AUTH,
|
||||
17 17 | find_user,
|
||||
18 |- init_app,
|
||||
19 18 | log,
|
||||
20 19 | requires_authentication,
|
||||
21 20 | )
|
||||
21 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import init_app
|
||||
22 22 |
|
||||
23 23 | log()
|
||||
24 24 | CLIENT_AUTH
|
||||
|
||||
AIR302_fab.py:27:1: AIR302 [*] `airflow.api.auth.backend.kerberos_auth.requires_authentication` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:27:1: AIR302 `airflow.api.auth.backend.kerberos_auth.requires_authentication` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
25 | find_user()
|
||||
26 | init_app()
|
||||
@@ -200,18 +96,7 @@ AIR302_fab.py:27:1: AIR302 [*] `airflow.api.auth.backend.kerberos_auth.requires_
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `requires_authentication` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
17 17 | find_user,
|
||||
18 18 | init_app,
|
||||
19 19 | log,
|
||||
20 |- requires_authentication,
|
||||
21 20 | )
|
||||
21 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import requires_authentication
|
||||
22 22 |
|
||||
23 23 | log()
|
||||
24 24 | CLIENT_AUTH
|
||||
|
||||
AIR302_fab.py:37:1: AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.log` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:37:1: AIR302 `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.log` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
35 | )
|
||||
36 |
|
||||
@@ -222,19 +107,7 @@ AIR302_fab.py:37:1: AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerbe
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `log` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
30 30 | CLIENT_AUTH,
|
||||
31 31 | find_user,
|
||||
32 32 | init_app,
|
||||
33 |- log,
|
||||
34 33 | requires_authentication,
|
||||
35 34 | )
|
||||
35 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import log
|
||||
36 36 |
|
||||
37 37 | log()
|
||||
38 38 | CLIENT_AUTH
|
||||
|
||||
AIR302_fab.py:38:1: AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.CLIENT_AUTH` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:38:1: AIR302 `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.CLIENT_AUTH` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
37 | log()
|
||||
38 | CLIENT_AUTH
|
||||
@@ -244,22 +117,7 @@ AIR302_fab.py:38:1: AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerbe
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `CLIENT_AUTH` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
27 27 | requires_authentication()
|
||||
28 28 |
|
||||
29 29 | from airflow.auth.managers.fab.api.auth.backend.kerberos_auth import (
|
||||
30 |- CLIENT_AUTH,
|
||||
31 30 | find_user,
|
||||
32 31 | init_app,
|
||||
33 32 | log,
|
||||
34 33 | requires_authentication,
|
||||
35 34 | )
|
||||
35 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import CLIENT_AUTH
|
||||
36 36 |
|
||||
37 37 | log()
|
||||
38 38 | CLIENT_AUTH
|
||||
|
||||
AIR302_fab.py:39:1: AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.find_user` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:39:1: AIR302 `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.find_user` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
37 | log()
|
||||
38 | CLIENT_AUTH
|
||||
@@ -270,21 +128,7 @@ AIR302_fab.py:39:1: AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerbe
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `find_user` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
28 28 |
|
||||
29 29 | from airflow.auth.managers.fab.api.auth.backend.kerberos_auth import (
|
||||
30 30 | CLIENT_AUTH,
|
||||
31 |- find_user,
|
||||
32 31 | init_app,
|
||||
33 32 | log,
|
||||
34 33 | requires_authentication,
|
||||
35 34 | )
|
||||
35 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import find_user
|
||||
36 36 |
|
||||
37 37 | log()
|
||||
38 38 | CLIENT_AUTH
|
||||
|
||||
AIR302_fab.py:40:1: AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.init_app` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:40:1: AIR302 `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.init_app` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
38 | CLIENT_AUTH
|
||||
39 | find_user()
|
||||
@@ -294,20 +138,7 @@ AIR302_fab.py:40:1: AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerbe
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `init_app` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
29 29 | from airflow.auth.managers.fab.api.auth.backend.kerberos_auth import (
|
||||
30 30 | CLIENT_AUTH,
|
||||
31 31 | find_user,
|
||||
32 |- init_app,
|
||||
33 32 | log,
|
||||
34 33 | requires_authentication,
|
||||
35 34 | )
|
||||
35 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import init_app
|
||||
36 36 |
|
||||
37 37 | log()
|
||||
38 38 | CLIENT_AUTH
|
||||
|
||||
AIR302_fab.py:41:1: AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.requires_authentication` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:41:1: AIR302 `airflow.auth.managers.fab.api.auth.backend.kerberos_auth.requires_authentication` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
39 | find_user()
|
||||
40 | init_app()
|
||||
@@ -318,18 +149,7 @@ AIR302_fab.py:41:1: AIR302 [*] `airflow.auth.managers.fab.api.auth.backend.kerbe
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `requires_authentication` from `airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
31 31 | find_user,
|
||||
32 32 | init_app,
|
||||
33 33 | log,
|
||||
34 |- requires_authentication,
|
||||
35 34 | )
|
||||
35 |+from airflow.providers.fab.auth_manager.api.auth.backend.kerberos_auth import requires_authentication
|
||||
36 36 |
|
||||
37 37 | log()
|
||||
38 38 | CLIENT_AUTH
|
||||
|
||||
AIR302_fab.py:49:1: AIR302 [*] `airflow.auth.managers.fab.fab_auth_manager.FabAuthManager` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:49:1: AIR302 `airflow.auth.managers.fab.fab_auth_manager.FabAuthManager` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
47 | )
|
||||
48 |
|
||||
@@ -340,21 +160,7 @@ AIR302_fab.py:49:1: AIR302 [*] `airflow.auth.managers.fab.fab_auth_manager.FabAu
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `FabAuthManager` from `airflow.providers.fab.auth_manager.fab_auth_manager` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
40 40 | init_app()
|
||||
41 41 | requires_authentication()
|
||||
42 42 |
|
||||
43 |-from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
|
||||
44 43 | from airflow.auth.managers.fab.security_manager.override import (
|
||||
45 44 | MAX_NUM_DATABASE_USER_SESSIONS,
|
||||
46 45 | FabAirflowSecurityManagerOverride,
|
||||
47 46 | )
|
||||
47 |+from airflow.providers.fab.auth_manager.fab_auth_manager import FabAuthManager
|
||||
48 48 |
|
||||
49 49 | FabAuthManager()
|
||||
50 50 | MAX_NUM_DATABASE_USER_SESSIONS
|
||||
|
||||
AIR302_fab.py:50:1: AIR302 [*] `airflow.auth.managers.fab.security_manager.override.MAX_NUM_DATABASE_USER_SESSIONS` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:50:1: AIR302 `airflow.auth.managers.fab.security_manager.override.MAX_NUM_DATABASE_USER_SESSIONS` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
49 | FabAuthManager()
|
||||
50 | MAX_NUM_DATABASE_USER_SESSIONS
|
||||
@@ -363,19 +169,7 @@ AIR302_fab.py:50:1: AIR302 [*] `airflow.auth.managers.fab.security_manager.overr
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `MAX_NUM_DATABASE_USER_SESSIONS` from `airflow.providers.fab.auth_manager.security_manager.override` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
42 42 |
|
||||
43 43 | from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
|
||||
44 44 | from airflow.auth.managers.fab.security_manager.override import (
|
||||
45 |- MAX_NUM_DATABASE_USER_SESSIONS,
|
||||
46 45 | FabAirflowSecurityManagerOverride,
|
||||
47 46 | )
|
||||
47 |+from airflow.providers.fab.auth_manager.security_manager.override import MAX_NUM_DATABASE_USER_SESSIONS
|
||||
48 48 |
|
||||
49 49 | FabAuthManager()
|
||||
50 50 | MAX_NUM_DATABASE_USER_SESSIONS
|
||||
|
||||
AIR302_fab.py:51:1: AIR302 [*] `airflow.auth.managers.fab.security_manager.override.FabAirflowSecurityManagerOverride` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:51:1: AIR302 `airflow.auth.managers.fab.security_manager.override.FabAirflowSecurityManagerOverride` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
49 | FabAuthManager()
|
||||
50 | MAX_NUM_DATABASE_USER_SESSIONS
|
||||
@@ -386,18 +180,7 @@ AIR302_fab.py:51:1: AIR302 [*] `airflow.auth.managers.fab.security_manager.overr
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `FabAirflowSecurityManagerOverride` from `airflow.providers.fab.auth_manager.security_manager.override` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
43 43 | from airflow.auth.managers.fab.fab_auth_manager import FabAuthManager
|
||||
44 44 | from airflow.auth.managers.fab.security_manager.override import (
|
||||
45 45 | MAX_NUM_DATABASE_USER_SESSIONS,
|
||||
46 |- FabAirflowSecurityManagerOverride,
|
||||
47 46 | )
|
||||
47 |+from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
|
||||
48 48 |
|
||||
49 49 | FabAuthManager()
|
||||
50 50 | MAX_NUM_DATABASE_USER_SESSIONS
|
||||
|
||||
AIR302_fab.py:55:1: AIR302 [*] `airflow.www.security.FabAirflowSecurityManagerOverride` is moved into `fab` provider in Airflow 3.0;
|
||||
AIR302_fab.py:55:1: AIR302 `airflow.www.security.FabAirflowSecurityManagerOverride` is moved into `fab` provider in Airflow 3.0;
|
||||
|
|
||||
53 | from airflow.www.security import FabAirflowSecurityManagerOverride
|
||||
54 |
|
||||
@@ -405,12 +188,3 @@ AIR302_fab.py:55:1: AIR302 [*] `airflow.www.security.FabAirflowSecurityManagerOv
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-fab>=1.0.0` and use `FabAirflowSecurityManagerOverride` from `airflow.providers.fab.auth_manager.security_manager.override` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
50 50 | MAX_NUM_DATABASE_USER_SESSIONS
|
||||
51 51 | FabAirflowSecurityManagerOverride()
|
||||
52 52 |
|
||||
53 |-from airflow.www.security import FabAirflowSecurityManagerOverride
|
||||
53 |+from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
|
||||
54 54 |
|
||||
55 55 | FabAirflowSecurityManagerOverride()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR302_hdfs.py:6:1: AIR302 [*] `airflow.hooks.webhdfs_hook.WebHDFSHook` is moved into `apache-hdfs` provider in Airflow 3.0;
|
||||
AIR302_hdfs.py:6:1: AIR302 `airflow.hooks.webhdfs_hook.WebHDFSHook` is moved into `apache-hdfs` provider in Airflow 3.0;
|
||||
|
|
||||
4 | from airflow.sensors.web_hdfs_sensor import WebHdfsSensor
|
||||
5 |
|
||||
@@ -11,30 +11,10 @@ AIR302_hdfs.py:6:1: AIR302 [*] `airflow.hooks.webhdfs_hook.WebHDFSHook` is moved
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hdfs>=1.0.0` and use `WebHDFSHook` from `airflow.providers.apache.hdfs.hooks.webhdfs` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.hooks.webhdfs_hook import WebHDFSHook
|
||||
4 3 | from airflow.sensors.web_hdfs_sensor import WebHdfsSensor
|
||||
4 |+from airflow.providers.apache.hdfs.hooks.webhdfs import WebHDFSHook
|
||||
5 5 |
|
||||
6 6 | WebHDFSHook()
|
||||
7 7 | WebHdfsSensor()
|
||||
|
||||
AIR302_hdfs.py:7:1: AIR302 [*] `airflow.sensors.web_hdfs_sensor.WebHdfsSensor` is moved into `apache-hdfs` provider in Airflow 3.0;
|
||||
AIR302_hdfs.py:7:1: AIR302 `airflow.sensors.web_hdfs_sensor.WebHdfsSensor` is moved into `apache-hdfs` provider in Airflow 3.0;
|
||||
|
|
||||
6 | WebHDFSHook()
|
||||
7 | WebHdfsSensor()
|
||||
| ^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hdfs>=1.0.0` and use `WebHdfsSensor` from `airflow.providers.apache.hdfs.sensors.web_hdfs` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.webhdfs_hook import WebHDFSHook
|
||||
4 |-from airflow.sensors.web_hdfs_sensor import WebHdfsSensor
|
||||
4 |+from airflow.providers.apache.hdfs.sensors.web_hdfs import WebHdfsSensor
|
||||
5 5 |
|
||||
6 6 | WebHDFSHook()
|
||||
7 7 | WebHdfsSensor()
|
||||
|
||||
@@ -1,452 +1,208 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR302_hive.py:18:1: AIR302 [*] `airflow.hooks.hive_hooks.HIVE_QUEUE_PRIORITIES` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:36:1: AIR302 `airflow.macros.hive.closest_ds_partition` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
16 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
17 |
|
||||
18 | HIVE_QUEUE_PRIORITIES
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
19 | HiveCliHook()
|
||||
20 | HiveMetastoreHook()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HIVE_QUEUE_PRIORITIES` from `airflow.providers.apache.hive.hooks.hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.hive_hooks import (
|
||||
4 |- HIVE_QUEUE_PRIORITIES,
|
||||
5 4 | HiveCliHook,
|
||||
6 5 | HiveMetastoreHook,
|
||||
7 6 | HiveServer2Hook,
|
||||
--------------------------------------------------------------------------------
|
||||
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
16 |+from airflow.providers.apache.hive.hooks.hive import HIVE_QUEUE_PRIORITIES
|
||||
17 17 |
|
||||
18 18 | HIVE_QUEUE_PRIORITIES
|
||||
19 19 | HiveCliHook()
|
||||
|
||||
AIR302_hive.py:19:1: AIR302 [*] `airflow.hooks.hive_hooks.HiveCliHook` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
18 | HIVE_QUEUE_PRIORITIES
|
||||
19 | HiveCliHook()
|
||||
| ^^^^^^^^^^^ AIR302
|
||||
20 | HiveMetastoreHook()
|
||||
21 | HiveServer2Hook()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveCliHook` from `airflow.providers.apache.hive.hooks.hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.hive_hooks import (
|
||||
4 4 | HIVE_QUEUE_PRIORITIES,
|
||||
5 |- HiveCliHook,
|
||||
6 5 | HiveMetastoreHook,
|
||||
7 6 | HiveServer2Hook,
|
||||
8 7 | )
|
||||
--------------------------------------------------------------------------------
|
||||
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
16 |+from airflow.providers.apache.hive.hooks.hive import HiveCliHook
|
||||
17 17 |
|
||||
18 18 | HIVE_QUEUE_PRIORITIES
|
||||
19 19 | HiveCliHook()
|
||||
|
||||
AIR302_hive.py:20:1: AIR302 [*] `airflow.hooks.hive_hooks.HiveMetastoreHook` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
18 | HIVE_QUEUE_PRIORITIES
|
||||
19 | HiveCliHook()
|
||||
20 | HiveMetastoreHook()
|
||||
| ^^^^^^^^^^^^^^^^^ AIR302
|
||||
21 | HiveServer2Hook()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveMetastoreHook` from `airflow.providers.apache.hive.hooks.hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
3 3 | from airflow.hooks.hive_hooks import (
|
||||
4 4 | HIVE_QUEUE_PRIORITIES,
|
||||
5 5 | HiveCliHook,
|
||||
6 |- HiveMetastoreHook,
|
||||
7 6 | HiveServer2Hook,
|
||||
8 7 | )
|
||||
9 8 | from airflow.macros.hive import (
|
||||
--------------------------------------------------------------------------------
|
||||
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
16 |+from airflow.providers.apache.hive.hooks.hive import HiveMetastoreHook
|
||||
17 17 |
|
||||
18 18 | HIVE_QUEUE_PRIORITIES
|
||||
19 19 | HiveCliHook()
|
||||
|
||||
AIR302_hive.py:21:1: AIR302 [*] `airflow.hooks.hive_hooks.HiveServer2Hook` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
19 | HiveCliHook()
|
||||
20 | HiveMetastoreHook()
|
||||
21 | HiveServer2Hook()
|
||||
| ^^^^^^^^^^^^^^^ AIR302
|
||||
22 |
|
||||
23 | closest_ds_partition()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveServer2Hook` from `airflow.providers.apache.hive.hooks.hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
4 4 | HIVE_QUEUE_PRIORITIES,
|
||||
5 5 | HiveCliHook,
|
||||
6 6 | HiveMetastoreHook,
|
||||
7 |- HiveServer2Hook,
|
||||
8 7 | )
|
||||
9 8 | from airflow.macros.hive import (
|
||||
10 9 | closest_ds_partition,
|
||||
--------------------------------------------------------------------------------
|
||||
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
16 |+from airflow.providers.apache.hive.hooks.hive import HiveServer2Hook
|
||||
17 17 |
|
||||
18 18 | HIVE_QUEUE_PRIORITIES
|
||||
19 19 | HiveCliHook()
|
||||
|
||||
AIR302_hive.py:23:1: AIR302 [*] `airflow.macros.hive.closest_ds_partition` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
21 | HiveServer2Hook()
|
||||
22 |
|
||||
23 | closest_ds_partition()
|
||||
34 | from airflow.sensors.named_hive_partition_sensor import NamedHivePartitionSensor
|
||||
35 |
|
||||
36 | closest_ds_partition()
|
||||
| ^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
24 | max_partition()
|
||||
37 | max_partition()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=5.1.0` and use `closest_ds_partition` from `airflow.providers.apache.hive.macros.hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
7 7 | HiveServer2Hook,
|
||||
8 8 | )
|
||||
9 9 | from airflow.macros.hive import (
|
||||
10 |- closest_ds_partition,
|
||||
11 10 | max_partition,
|
||||
12 11 | )
|
||||
13 12 | from airflow.operators.hive_operator import HiveOperator
|
||||
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
16 |+from airflow.providers.apache.hive.macros.hive import closest_ds_partition
|
||||
17 17 |
|
||||
18 18 | HIVE_QUEUE_PRIORITIES
|
||||
19 19 | HiveCliHook()
|
||||
|
||||
AIR302_hive.py:24:1: AIR302 [*] `airflow.macros.hive.max_partition` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:37:1: AIR302 `airflow.macros.hive.max_partition` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
23 | closest_ds_partition()
|
||||
24 | max_partition()
|
||||
36 | closest_ds_partition()
|
||||
37 | max_partition()
|
||||
| ^^^^^^^^^^^^^ AIR302
|
||||
25 |
|
||||
26 | HiveOperator()
|
||||
38 |
|
||||
39 | HiveCliHook()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=5.1.0` and use `max_partition` from `airflow.providers.apache.hive.macros.hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
8 8 | )
|
||||
9 9 | from airflow.macros.hive import (
|
||||
10 10 | closest_ds_partition,
|
||||
11 |- max_partition,
|
||||
12 11 | )
|
||||
13 12 | from airflow.operators.hive_operator import HiveOperator
|
||||
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
16 |+from airflow.providers.apache.hive.macros.hive import max_partition
|
||||
17 17 |
|
||||
18 18 | HIVE_QUEUE_PRIORITIES
|
||||
19 19 | HiveCliHook()
|
||||
|
||||
AIR302_hive.py:26:1: AIR302 [*] `airflow.operators.hive_operator.HiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:39:1: AIR302 `airflow.hooks.hive_hooks.HiveCliHook` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
24 | max_partition()
|
||||
25 |
|
||||
26 | HiveOperator()
|
||||
37 | max_partition()
|
||||
38 |
|
||||
39 | HiveCliHook()
|
||||
| ^^^^^^^^^^^ AIR302
|
||||
40 | HiveMetastoreHook()
|
||||
41 | HiveServer2Hook()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveCliHook` from `airflow.providers.apache.hive.hooks.hive` instead.
|
||||
|
||||
AIR302_hive.py:40:1: AIR302 `airflow.hooks.hive_hooks.HiveMetastoreHook` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
39 | HiveCliHook()
|
||||
40 | HiveMetastoreHook()
|
||||
| ^^^^^^^^^^^^^^^^^ AIR302
|
||||
41 | HiveServer2Hook()
|
||||
42 | HIVE_QUEUE_PRIORITIES
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveMetastoreHook` from `airflow.providers.apache.hive.hooks.hive` instead.
|
||||
|
||||
AIR302_hive.py:41:1: AIR302 `airflow.hooks.hive_hooks.HiveServer2Hook` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
39 | HiveCliHook()
|
||||
40 | HiveMetastoreHook()
|
||||
41 | HiveServer2Hook()
|
||||
| ^^^^^^^^^^^^^^^ AIR302
|
||||
42 | HIVE_QUEUE_PRIORITIES
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveServer2Hook` from `airflow.providers.apache.hive.hooks.hive` instead.
|
||||
|
||||
AIR302_hive.py:42:1: AIR302 `airflow.hooks.hive_hooks.HIVE_QUEUE_PRIORITIES` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
40 | HiveMetastoreHook()
|
||||
41 | HiveServer2Hook()
|
||||
42 | HIVE_QUEUE_PRIORITIES
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
43 |
|
||||
44 | HiveOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HIVE_QUEUE_PRIORITIES` from `airflow.providers.apache.hive.hooks.hive` instead.
|
||||
|
||||
AIR302_hive.py:44:1: AIR302 `airflow.operators.hive_operator.HiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
42 | HIVE_QUEUE_PRIORITIES
|
||||
43 |
|
||||
44 | HiveOperator()
|
||||
| ^^^^^^^^^^^^ AIR302
|
||||
27 | HiveStatsCollectionOperator()
|
||||
28 | HiveToMySqlOperator()
|
||||
45 |
|
||||
46 | HiveStatsCollectionOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveOperator` from `airflow.providers.apache.hive.operators.hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
10 10 | closest_ds_partition,
|
||||
11 11 | max_partition,
|
||||
12 12 | )
|
||||
13 |-from airflow.operators.hive_operator import HiveOperator
|
||||
14 13 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
16 |+from airflow.providers.apache.hive.operators.hive import HiveOperator
|
||||
17 17 |
|
||||
18 18 | HIVE_QUEUE_PRIORITIES
|
||||
19 19 | HiveCliHook()
|
||||
|
||||
AIR302_hive.py:27:1: AIR302 [*] `airflow.operators.hive_stats_operator.HiveStatsCollectionOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:46:1: AIR302 `airflow.operators.hive_stats_operator.HiveStatsCollectionOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
26 | HiveOperator()
|
||||
27 | HiveStatsCollectionOperator()
|
||||
44 | HiveOperator()
|
||||
45 |
|
||||
46 | HiveStatsCollectionOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
28 | HiveToMySqlOperator()
|
||||
29 | HiveToSambaOperator()
|
||||
47 |
|
||||
48 | HiveToMySqlOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveStatsCollectionOperator` from `airflow.providers.apache.hive.operators.hive_stats` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
11 11 | max_partition,
|
||||
12 12 | )
|
||||
13 13 | from airflow.operators.hive_operator import HiveOperator
|
||||
14 |-from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
15 14 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
16 |+from airflow.providers.apache.hive.operators.hive_stats import HiveStatsCollectionOperator
|
||||
17 17 |
|
||||
18 18 | HIVE_QUEUE_PRIORITIES
|
||||
19 19 | HiveCliHook()
|
||||
|
||||
AIR302_hive.py:28:1: AIR302 [*] `airflow.operators.hive_to_mysql.HiveToMySqlOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:48:1: AIR302 `airflow.operators.hive_to_mysql.HiveToMySqlOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
26 | HiveOperator()
|
||||
27 | HiveStatsCollectionOperator()
|
||||
28 | HiveToMySqlOperator()
|
||||
46 | HiveStatsCollectionOperator()
|
||||
47 |
|
||||
48 | HiveToMySqlOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
29 | HiveToSambaOperator()
|
||||
49 | HiveToMySqlTransfer()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveToMySqlOperator` from `airflow.providers.apache.hive.transfers.hive_to_mysql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
12 12 | )
|
||||
13 13 | from airflow.operators.hive_operator import HiveOperator
|
||||
14 14 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
15 |-from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
16 15 | from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
16 |+from airflow.providers.apache.hive.transfers.hive_to_mysql import HiveToMySqlOperator
|
||||
17 17 |
|
||||
18 18 | HIVE_QUEUE_PRIORITIES
|
||||
19 19 | HiveCliHook()
|
||||
|
||||
AIR302_hive.py:29:1: AIR302 [*] `airflow.operators.hive_to_samba_operator.HiveToSambaOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:49:1: AIR302 `airflow.operators.hive_to_mysql.HiveToMySqlTransfer` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
27 | HiveStatsCollectionOperator()
|
||||
28 | HiveToMySqlOperator()
|
||||
29 | HiveToSambaOperator()
|
||||
48 | HiveToMySqlOperator()
|
||||
49 | HiveToMySqlTransfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
50 |
|
||||
51 | HiveToSambaOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveToMySqlOperator` from `airflow.providers.apache.hive.transfers.hive_to_mysql` instead.
|
||||
|
||||
AIR302_hive.py:51:1: AIR302 `airflow.operators.hive_to_samba_operator.HiveToSambaOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
49 | HiveToMySqlTransfer()
|
||||
50 |
|
||||
51 | HiveToSambaOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
52 |
|
||||
53 | MsSqlToHiveOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveToSambaOperator` from `airflow.providers.apache.hive.transfers.hive_to_samba` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
13 13 | from airflow.operators.hive_operator import HiveOperator
|
||||
14 14 | from airflow.operators.hive_stats_operator import HiveStatsCollectionOperator
|
||||
15 15 | from airflow.operators.hive_to_mysql import HiveToMySqlOperator
|
||||
16 |-from airflow.operators.hive_to_samba_operator import HiveToSambaOperator
|
||||
16 |+from airflow.providers.apache.hive.transfers.hive_to_samba import HiveToSambaOperator
|
||||
17 17 |
|
||||
18 18 | HIVE_QUEUE_PRIORITIES
|
||||
19 19 | HiveCliHook()
|
||||
|
||||
AIR302_hive.py:34:1: AIR302 [*] `airflow.operators.hive_to_mysql.HiveToMySqlTransfer` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:53:1: AIR302 `airflow.operators.mssql_to_hive.MsSqlToHiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
32 | from airflow.operators.hive_to_mysql import HiveToMySqlTransfer
|
||||
33 |
|
||||
34 | HiveToMySqlTransfer()
|
||||
51 | HiveToSambaOperator()
|
||||
52 |
|
||||
53 | MsSqlToHiveOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
35 |
|
||||
36 | from airflow.operators.mysql_to_hive import MySqlToHiveOperator
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HiveToMySqlOperator` from `airflow.providers.apache.hive.transfers.hive_to_mysql` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
30 30 |
|
||||
31 31 |
|
||||
32 32 | from airflow.operators.hive_to_mysql import HiveToMySqlTransfer
|
||||
33 |+from airflow.providers.apache.hive.transfers.hive_to_mysql import HiveToMySqlOperator
|
||||
33 34 |
|
||||
34 35 | HiveToMySqlTransfer()
|
||||
35 36 |
|
||||
|
||||
AIR302_hive.py:38:1: AIR302 [*] `airflow.operators.mysql_to_hive.MySqlToHiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
36 | from airflow.operators.mysql_to_hive import MySqlToHiveOperator
|
||||
37 |
|
||||
38 | MySqlToHiveOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
39 |
|
||||
40 | from airflow.operators.mysql_to_hive import MySqlToHiveTransfer
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MySqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mysql_to_hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
33 33 |
|
||||
34 34 | HiveToMySqlTransfer()
|
||||
35 35 |
|
||||
36 |-from airflow.operators.mysql_to_hive import MySqlToHiveOperator
|
||||
36 |+from airflow.providers.apache.hive.transfers.mysql_to_hive import MySqlToHiveOperator
|
||||
37 37 |
|
||||
38 38 | MySqlToHiveOperator()
|
||||
39 39 |
|
||||
|
||||
AIR302_hive.py:42:1: AIR302 [*] `airflow.operators.mysql_to_hive.MySqlToHiveTransfer` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
40 | from airflow.operators.mysql_to_hive import MySqlToHiveTransfer
|
||||
41 |
|
||||
42 | MySqlToHiveTransfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
43 |
|
||||
44 | from airflow.operators.mssql_to_hive import MsSqlToHiveOperator
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MySqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mysql_to_hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
38 38 | MySqlToHiveOperator()
|
||||
39 39 |
|
||||
40 40 | from airflow.operators.mysql_to_hive import MySqlToHiveTransfer
|
||||
41 |+from airflow.providers.apache.hive.transfers.mysql_to_hive import MySqlToHiveOperator
|
||||
41 42 |
|
||||
42 43 | MySqlToHiveTransfer()
|
||||
43 44 |
|
||||
|
||||
AIR302_hive.py:46:1: AIR302 [*] `airflow.operators.mssql_to_hive.MsSqlToHiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
44 | from airflow.operators.mssql_to_hive import MsSqlToHiveOperator
|
||||
45 |
|
||||
46 | MsSqlToHiveOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
47 |
|
||||
48 | from airflow.operators.mssql_to_hive import MsSqlToHiveTransfer
|
||||
54 | MsSqlToHiveTransfer()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MsSqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mssql_to_hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
41 41 |
|
||||
42 42 | MySqlToHiveTransfer()
|
||||
43 43 |
|
||||
44 |-from airflow.operators.mssql_to_hive import MsSqlToHiveOperator
|
||||
44 |+from airflow.providers.apache.hive.transfers.mssql_to_hive import MsSqlToHiveOperator
|
||||
45 45 |
|
||||
46 46 | MsSqlToHiveOperator()
|
||||
47 47 |
|
||||
|
||||
AIR302_hive.py:50:1: AIR302 [*] `airflow.operators.mssql_to_hive.MsSqlToHiveTransfer` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:54:1: AIR302 `airflow.operators.mssql_to_hive.MsSqlToHiveTransfer` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
48 | from airflow.operators.mssql_to_hive import MsSqlToHiveTransfer
|
||||
49 |
|
||||
50 | MsSqlToHiveTransfer()
|
||||
53 | MsSqlToHiveOperator()
|
||||
54 | MsSqlToHiveTransfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
51 |
|
||||
52 | from airflow.operators.s3_to_hive_operator import S3ToHiveOperator
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MsSqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mssql_to_hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
46 46 | MsSqlToHiveOperator()
|
||||
47 47 |
|
||||
48 48 | from airflow.operators.mssql_to_hive import MsSqlToHiveTransfer
|
||||
49 |+from airflow.providers.apache.hive.transfers.mssql_to_hive import MsSqlToHiveOperator
|
||||
49 50 |
|
||||
50 51 | MsSqlToHiveTransfer()
|
||||
51 52 |
|
||||
|
||||
AIR302_hive.py:54:1: AIR302 [*] `airflow.operators.s3_to_hive_operator.S3ToHiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
52 | from airflow.operators.s3_to_hive_operator import S3ToHiveOperator
|
||||
53 |
|
||||
54 | S3ToHiveOperator()
|
||||
| ^^^^^^^^^^^^^^^^ AIR302
|
||||
55 |
|
||||
56 | from airflow.operators.s3_to_hive_operator import S3ToHiveTransfer
|
||||
56 | MySqlToHiveOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `S3ToHiveOperator` from `airflow.providers.apache.hive.transfers.s3_to_hive` instead.
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MsSqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mssql_to_hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
49 49 |
|
||||
50 50 | MsSqlToHiveTransfer()
|
||||
51 51 |
|
||||
52 |-from airflow.operators.s3_to_hive_operator import S3ToHiveOperator
|
||||
52 |+from airflow.providers.apache.hive.transfers.s3_to_hive import S3ToHiveOperator
|
||||
53 53 |
|
||||
54 54 | S3ToHiveOperator()
|
||||
55 55 |
|
||||
|
||||
AIR302_hive.py:58:1: AIR302 [*] `airflow.operators.s3_to_hive_operator.S3ToHiveTransfer` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:56:1: AIR302 `airflow.operators.mysql_to_hive.MySqlToHiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
56 | from airflow.operators.s3_to_hive_operator import S3ToHiveTransfer
|
||||
57 |
|
||||
58 | S3ToHiveTransfer()
|
||||
54 | MsSqlToHiveTransfer()
|
||||
55 |
|
||||
56 | MySqlToHiveOperator()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
57 | MySqlToHiveTransfer()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MySqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mysql_to_hive` instead.
|
||||
|
||||
AIR302_hive.py:57:1: AIR302 `airflow.operators.mysql_to_hive.MySqlToHiveTransfer` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
56 | MySqlToHiveOperator()
|
||||
57 | MySqlToHiveTransfer()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
58 |
|
||||
59 | S3ToHiveOperator()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MySqlToHiveOperator` from `airflow.providers.apache.hive.transfers.mysql_to_hive` instead.
|
||||
|
||||
AIR302_hive.py:59:1: AIR302 `airflow.operators.s3_to_hive_operator.S3ToHiveOperator` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
57 | MySqlToHiveTransfer()
|
||||
58 |
|
||||
59 | S3ToHiveOperator()
|
||||
| ^^^^^^^^^^^^^^^^ AIR302
|
||||
59 |
|
||||
60 | from airflow.sensors.hive_partition_sensor import HivePartitionSensor
|
||||
60 | S3ToHiveTransfer()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `S3ToHiveOperator` from `airflow.providers.apache.hive.transfers.s3_to_hive` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
54 54 | S3ToHiveOperator()
|
||||
55 55 |
|
||||
56 56 | from airflow.operators.s3_to_hive_operator import S3ToHiveTransfer
|
||||
57 |+from airflow.providers.apache.hive.transfers.s3_to_hive import S3ToHiveOperator
|
||||
57 58 |
|
||||
58 59 | S3ToHiveTransfer()
|
||||
59 60 |
|
||||
|
||||
AIR302_hive.py:62:1: AIR302 [*] `airflow.sensors.hive_partition_sensor.HivePartitionSensor` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:60:1: AIR302 `airflow.operators.s3_to_hive_operator.S3ToHiveTransfer` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
60 | from airflow.sensors.hive_partition_sensor import HivePartitionSensor
|
||||
59 | S3ToHiveOperator()
|
||||
60 | S3ToHiveTransfer()
|
||||
| ^^^^^^^^^^^^^^^^ AIR302
|
||||
61 |
|
||||
62 | HivePartitionSensor()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `S3ToHiveOperator` from `airflow.providers.apache.hive.transfers.s3_to_hive` instead.
|
||||
|
||||
AIR302_hive.py:62:1: AIR302 `airflow.sensors.hive_partition_sensor.HivePartitionSensor` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
60 | S3ToHiveTransfer()
|
||||
61 |
|
||||
62 | HivePartitionSensor()
|
||||
| ^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
63 |
|
||||
64 | from airflow.sensors.metastore_partition_sensor import MetastorePartitionSensor
|
||||
64 | MetastorePartitionSensor()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `HivePartitionSensor` from `airflow.providers.apache.hive.sensors.hive_partition` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
57 57 |
|
||||
58 58 | S3ToHiveTransfer()
|
||||
59 59 |
|
||||
60 |-from airflow.sensors.hive_partition_sensor import HivePartitionSensor
|
||||
60 |+from airflow.providers.apache.hive.sensors.hive_partition import HivePartitionSensor
|
||||
61 61 |
|
||||
62 62 | HivePartitionSensor()
|
||||
63 63 |
|
||||
|
||||
AIR302_hive.py:66:1: AIR302 [*] `airflow.sensors.metastore_partition_sensor.MetastorePartitionSensor` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:64:1: AIR302 `airflow.sensors.metastore_partition_sensor.MetastorePartitionSensor` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
64 | from airflow.sensors.metastore_partition_sensor import MetastorePartitionSensor
|
||||
65 |
|
||||
66 | MetastorePartitionSensor()
|
||||
62 | HivePartitionSensor()
|
||||
63 |
|
||||
64 | MetastorePartitionSensor()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
67 |
|
||||
68 | from airflow.sensors.named_hive_partition_sensor import NamedHivePartitionSensor
|
||||
65 |
|
||||
66 | NamedHivePartitionSensor()
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `MetastorePartitionSensor` from `airflow.providers.apache.hive.sensors.metastore_partition` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
61 61 |
|
||||
62 62 | HivePartitionSensor()
|
||||
63 63 |
|
||||
64 |-from airflow.sensors.metastore_partition_sensor import MetastorePartitionSensor
|
||||
64 |+from airflow.providers.apache.hive.sensors.metastore_partition import MetastorePartitionSensor
|
||||
65 65 |
|
||||
66 66 | MetastorePartitionSensor()
|
||||
67 67 |
|
||||
|
||||
AIR302_hive.py:70:1: AIR302 [*] `airflow.sensors.named_hive_partition_sensor.NamedHivePartitionSensor` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
AIR302_hive.py:66:1: AIR302 `airflow.sensors.named_hive_partition_sensor.NamedHivePartitionSensor` is moved into `apache-hive` provider in Airflow 3.0;
|
||||
|
|
||||
68 | from airflow.sensors.named_hive_partition_sensor import NamedHivePartitionSensor
|
||||
69 |
|
||||
70 | NamedHivePartitionSensor()
|
||||
64 | MetastorePartitionSensor()
|
||||
65 |
|
||||
66 | NamedHivePartitionSensor()
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-apache-hive>=1.0.0` and use `NamedHivePartitionSensor` from `airflow.providers.apache.hive.sensors.named_hive_partition` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
65 65 |
|
||||
66 66 | MetastorePartitionSensor()
|
||||
67 67 |
|
||||
68 |-from airflow.sensors.named_hive_partition_sensor import NamedHivePartitionSensor
|
||||
68 |+from airflow.providers.apache.hive.sensors.named_hive_partition import NamedHivePartitionSensor
|
||||
69 69 |
|
||||
70 70 | NamedHivePartitionSensor()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR302_http.py:7:1: AIR302 [*] `airflow.hooks.http_hook.HttpHook` is moved into `http` provider in Airflow 3.0;
|
||||
AIR302_http.py:7:1: AIR302 `airflow.hooks.http_hook.HttpHook` is moved into `http` provider in Airflow 3.0;
|
||||
|
|
||||
5 | from airflow.sensors.http_sensor import HttpSensor
|
||||
6 |
|
||||
@@ -12,17 +12,6 @@ AIR302_http.py:7:1: AIR302 [*] `airflow.hooks.http_hook.HttpHook` is moved into
|
||||
|
|
||||
= help: Install `apache-airflow-providers-http>=1.0.0` and use `HttpHook` from `airflow.providers.http.hooks.http` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 |-from airflow.hooks.http_hook import HttpHook
|
||||
4 3 | from airflow.operators.http_operator import SimpleHttpOperator
|
||||
5 4 | from airflow.sensors.http_sensor import HttpSensor
|
||||
5 |+from airflow.providers.http.hooks.http import HttpHook
|
||||
6 6 |
|
||||
7 7 | HttpHook()
|
||||
8 8 | SimpleHttpOperator()
|
||||
|
||||
AIR302_http.py:8:1: AIR302 [*] `airflow.operators.http_operator.SimpleHttpOperator` is moved into `http` provider in Airflow 3.0;
|
||||
|
|
||||
7 | HttpHook()
|
||||
@@ -43,7 +32,7 @@ AIR302_http.py:8:1: AIR302 [*] `airflow.operators.http_operator.SimpleHttpOperat
|
||||
9 |+HttpOperator()
|
||||
9 10 | HttpSensor()
|
||||
|
||||
AIR302_http.py:9:1: AIR302 [*] `airflow.sensors.http_sensor.HttpSensor` is moved into `http` provider in Airflow 3.0;
|
||||
AIR302_http.py:9:1: AIR302 `airflow.sensors.http_sensor.HttpSensor` is moved into `http` provider in Airflow 3.0;
|
||||
|
|
||||
7 | HttpHook()
|
||||
8 | SimpleHttpOperator()
|
||||
@@ -51,13 +40,3 @@ AIR302_http.py:9:1: AIR302 [*] `airflow.sensors.http_sensor.HttpSensor` is moved
|
||||
| ^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-http>=1.0.0` and use `HttpSensor` from `airflow.providers.http.sensors.http` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.http_hook import HttpHook
|
||||
4 4 | from airflow.operators.http_operator import SimpleHttpOperator
|
||||
5 |-from airflow.sensors.http_sensor import HttpSensor
|
||||
5 |+from airflow.providers.http.sensors.http import HttpSensor
|
||||
6 6 |
|
||||
7 7 | HttpHook()
|
||||
8 8 | SimpleHttpOperator()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
source: crates/ruff_linter/src/rules/airflow/mod.rs
|
||||
---
|
||||
AIR302_jdbc.py:8:1: AIR302 [*] `airflow.hooks.jdbc_hook.JdbcHook` is moved into `jdbc` provider in Airflow 3.0;
|
||||
AIR302_jdbc.py:8:1: AIR302 `airflow.hooks.jdbc_hook.JdbcHook` is moved into `jdbc` provider in Airflow 3.0;
|
||||
|
|
||||
6 | )
|
||||
7 |
|
||||
@@ -11,33 +11,10 @@ AIR302_jdbc.py:8:1: AIR302 [*] `airflow.hooks.jdbc_hook.JdbcHook` is moved into
|
||||
|
|
||||
= help: Install `apache-airflow-providers-jdbc>=1.0.0` and use `JdbcHook` from `airflow.providers.jdbc.hooks.jdbc` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
1 1 | from __future__ import annotations
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.jdbc_hook import (
|
||||
4 |- JdbcHook,
|
||||
5 4 | jaydebeapi,
|
||||
6 5 | )
|
||||
6 |+from airflow.providers.jdbc.hooks.jdbc import JdbcHook
|
||||
7 7 |
|
||||
8 8 | JdbcHook()
|
||||
9 9 | jaydebeapi()
|
||||
|
||||
AIR302_jdbc.py:9:1: AIR302 [*] `airflow.hooks.jdbc_hook.jaydebeapi` is moved into `jdbc` provider in Airflow 3.0;
|
||||
AIR302_jdbc.py:9:1: AIR302 `airflow.hooks.jdbc_hook.jaydebeapi` is moved into `jdbc` provider in Airflow 3.0;
|
||||
|
|
||||
8 | JdbcHook()
|
||||
9 | jaydebeapi()
|
||||
| ^^^^^^^^^^ AIR302
|
||||
|
|
||||
= help: Install `apache-airflow-providers-jdbc>=1.0.0` and use `jaydebeapi` from `airflow.providers.jdbc.hooks.jdbc` instead.
|
||||
|
||||
ℹ Unsafe fix
|
||||
2 2 |
|
||||
3 3 | from airflow.hooks.jdbc_hook import (
|
||||
4 4 | JdbcHook,
|
||||
5 |- jaydebeapi,
|
||||
6 5 | )
|
||||
6 |+from airflow.providers.jdbc.hooks.jdbc import jaydebeapi
|
||||
7 7 |
|
||||
8 8 | JdbcHook()
|
||||
9 9 | jaydebeapi()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user