mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:15:12 +00:00
parent
8b925ea626
commit
b46cc6ac0b
10 changed files with 77 additions and 47 deletions
63
Cargo.lock
generated
63
Cargo.lock
generated
|
@ -212,6 +212,12 @@ dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "boxcar"
|
||||||
|
version = "0.2.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7f839cdf7e2d3198ac6ca003fd8ebc61715755f41c1cad15ff13df67531e00ed"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bstr"
|
name = "bstr"
|
||||||
version = "1.11.0"
|
version = "1.11.0"
|
||||||
|
@ -1935,18 +1941,6 @@ version = "0.8.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e3aeb8f54c078314c2065ee649a7241f46b9d8e418e1a9581ba0546657d7aa3a"
|
checksum = "e3aeb8f54c078314c2065ee649a7241f46b9d8e418e1a9581ba0546657d7aa3a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pep440_rs"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e0c29f9c43de378b4e4e0cd7dbcce0e5cfb80443de8c05620368b2948bc936a1"
|
|
||||||
dependencies = [
|
|
||||||
"once_cell",
|
|
||||||
"regex",
|
|
||||||
"serde",
|
|
||||||
"unicode-width 0.1.13",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pep440_rs"
|
name = "pep440_rs"
|
||||||
version = "0.7.2"
|
version = "0.7.2"
|
||||||
|
@ -1956,22 +1950,29 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"unicode-width 0.2.0",
|
"unicode-width 0.2.0",
|
||||||
"unscanny",
|
"unscanny",
|
||||||
|
"version-ranges",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pep508_rs"
|
name = "pep508_rs"
|
||||||
version = "0.3.0"
|
version = "0.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "910c513bea0f4f833122321c0f20e8c704e01de98692f6989c2ec21f43d88b1e"
|
checksum = "8c2feee999fa547bacab06a4881bacc74688858b92fa8ef1e206c748b0a76048"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"boxcar",
|
||||||
|
"indexmap",
|
||||||
|
"itertools 0.13.0",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"pep440_rs 0.4.0",
|
"pep440_rs",
|
||||||
"regex",
|
"regex",
|
||||||
|
"rustc-hash 2.0.0",
|
||||||
"serde",
|
"serde",
|
||||||
|
"smallvec",
|
||||||
"thiserror 1.0.67",
|
"thiserror 1.0.67",
|
||||||
"tracing",
|
"unicode-width 0.2.0",
|
||||||
"unicode-width 0.1.13",
|
|
||||||
"url",
|
"url",
|
||||||
|
"urlencoding",
|
||||||
|
"version-ranges",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2135,14 +2136,15 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyproject-toml"
|
name = "pyproject-toml"
|
||||||
version = "0.9.0"
|
version = "0.13.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "95c3dd745f99aa3c554b7bb00859f7d18c2f1d6afd749ccc86d60b61e702abd9"
|
checksum = "643af57c3f36ba90a8b53e972727d8092f7408a9ebfbaf4c3d2c17b07c58d835"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"pep440_rs 0.4.0",
|
"pep440_rs",
|
||||||
"pep508_rs",
|
"pep508_rs",
|
||||||
"serde",
|
"serde",
|
||||||
|
"thiserror 1.0.67",
|
||||||
"toml",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -2370,7 +2372,7 @@ dependencies = [
|
||||||
"glob",
|
"glob",
|
||||||
"insta",
|
"insta",
|
||||||
"notify",
|
"notify",
|
||||||
"pep440_rs 0.7.2",
|
"pep440_rs",
|
||||||
"rayon",
|
"rayon",
|
||||||
"red_knot_python_semantic",
|
"red_knot_python_semantic",
|
||||||
"red_knot_vendored",
|
"red_knot_vendored",
|
||||||
|
@ -2729,7 +2731,7 @@ dependencies = [
|
||||||
"natord",
|
"natord",
|
||||||
"path-absolutize",
|
"path-absolutize",
|
||||||
"pathdiff",
|
"pathdiff",
|
||||||
"pep440_rs 0.7.2",
|
"pep440_rs",
|
||||||
"pyproject-toml",
|
"pyproject-toml",
|
||||||
"quick-junit",
|
"quick-junit",
|
||||||
"regex",
|
"regex",
|
||||||
|
@ -3060,7 +3062,7 @@ dependencies = [
|
||||||
"matchit",
|
"matchit",
|
||||||
"path-absolutize",
|
"path-absolutize",
|
||||||
"path-slash",
|
"path-slash",
|
||||||
"pep440_rs 0.7.2",
|
"pep440_rs",
|
||||||
"regex",
|
"regex",
|
||||||
"ruff_cache",
|
"ruff_cache",
|
||||||
"ruff_formatter",
|
"ruff_formatter",
|
||||||
|
@ -3960,6 +3962,12 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "urlencoding"
|
||||||
|
version = "2.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "utf16_iter"
|
name = "utf16_iter"
|
||||||
version = "1.0.5"
|
version = "1.0.5"
|
||||||
|
@ -4007,6 +4015,15 @@ version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "version-ranges"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f8d079415ceb2be83fc355adbadafe401307d5c309c7e6ade6638e6f9f42f42d"
|
||||||
|
dependencies = [
|
||||||
|
"smallvec",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
|
|
|
@ -111,7 +111,7 @@ pathdiff = { version = "0.2.1" }
|
||||||
pep440_rs = { version = "0.7.1" }
|
pep440_rs = { version = "0.7.1" }
|
||||||
pretty_assertions = "1.3.0"
|
pretty_assertions = "1.3.0"
|
||||||
proc-macro2 = { version = "1.0.79" }
|
proc-macro2 = { version = "1.0.79" }
|
||||||
pyproject-toml = { version = "0.9.0" }
|
pyproject-toml = { version = "0.13.4" }
|
||||||
quick-junit = { version = "0.5.0" }
|
quick-junit = { version = "0.5.0" }
|
||||||
quote = { version = "1.0.23" }
|
quote = { version = "1.0.23" }
|
||||||
rand = { version = "0.8.5" }
|
rand = { version = "0.8.5" }
|
||||||
|
|
6
crates/ruff_linter/resources/test/fixtures/ruff/pyproject_toml/pep639/pyproject.toml
vendored
Normal file
6
crates/ruff_linter/resources/test/fixtures/ruff/pyproject_toml/pep639/pyproject.toml
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[project]
|
||||||
|
name = "hello-world"
|
||||||
|
version = "0.1.0"
|
||||||
|
# PEP 639 - passing
|
||||||
|
license = "MIT OR GPL-2.0-or-later OR (FSFUL AND BSD-2-Clause)"
|
||||||
|
license-files = ["LICEN[CS]E*", "AUTHORS*", "licenses/LICENSE.MIT"]
|
|
@ -1,5 +1,3 @@
|
||||||
# license-files is wrong here
|
|
||||||
# https://github.com/PyO3/maturin/issues/1615
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = [ "maturin>=0.14", "numpy", "wheel", "patchelf",]
|
requires = [ "maturin>=0.14", "numpy", "wheel", "patchelf",]
|
||||||
build-backend = "maturin"
|
build-backend = "maturin"
|
|
@ -372,7 +372,8 @@ mod tests {
|
||||||
#[test_case(Rule::InvalidPyprojectToml, Path::new("bleach"))]
|
#[test_case(Rule::InvalidPyprojectToml, Path::new("bleach"))]
|
||||||
#[test_case(Rule::InvalidPyprojectToml, Path::new("invalid_author"))]
|
#[test_case(Rule::InvalidPyprojectToml, Path::new("invalid_author"))]
|
||||||
#[test_case(Rule::InvalidPyprojectToml, Path::new("maturin"))]
|
#[test_case(Rule::InvalidPyprojectToml, Path::new("maturin"))]
|
||||||
#[test_case(Rule::InvalidPyprojectToml, Path::new("maturin_gh_1615"))]
|
#[test_case(Rule::InvalidPyprojectToml, Path::new("various_invalid"))]
|
||||||
|
#[test_case(Rule::InvalidPyprojectToml, Path::new("pep639"))]
|
||||||
fn invalid_pyproject_toml(rule_code: Rule, path: &Path) -> Result<()> {
|
fn invalid_pyproject_toml(rule_code: Rule, path: &Path) -> Result<()> {
|
||||||
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
|
let snapshot = format!("{}_{}", rule_code.noqa_code(), path.to_string_lossy());
|
||||||
let path = test_resource_path("fixtures")
|
let path = test_resource_path("fixtures")
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
source: crates/ruff_linter/src/rules/ruff/mod.rs
|
source: crates/ruff_linter/src/rules/ruff/mod.rs
|
||||||
snapshot_kind: text
|
snapshot_kind: text
|
||||||
---
|
---
|
||||||
pyproject.toml:5:16: RUF200 Failed to parse pyproject.toml: Version specifier `>=1.1.0<1.2` doesn't match PEP 440 rules
|
pyproject.toml:5:16: RUF200 Failed to parse pyproject.toml: after parsing `1.1.0`, found `<1.2`, which is not part of a valid version
|
||||||
tinycss2>=1.1.0<1.2
|
tinycss2>=1.1.0<1.2
|
||||||
^^^^^^^^^^^
|
^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
source: crates/ruff_linter/src/rules/ruff/mod.rs
|
source: crates/ruff_linter/src/rules/ruff/mod.rs
|
||||||
snapshot_kind: text
|
snapshot_kind: text
|
||||||
---
|
---
|
||||||
pyproject.toml:6:84: RUF200 Failed to parse pyproject.toml: invalid type: integer `1`, expected a string
|
pyproject.toml:5:11: RUF200 Failed to parse pyproject.toml: a table with 'name' and/or 'email' keys
|
||||||
|
|
|
|
||||||
|
3 | version = "0.1.0"
|
||||||
4 | # Ensure that the spans from toml handle utf-8 correctly
|
4 | # Ensure that the spans from toml handle utf-8 correctly
|
||||||
5 | authors = [
|
5 | authors = [
|
||||||
6 | { name = "Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ͫ͗͢L̠ͨͧͩ͘G̴̻͈͍͔̹̑͗̎̅͛́Ǫ̵̹̻̝̳͂̌̌͘", email = 1 }
|
| ___________^
|
||||||
| ^ RUF200
|
6 | | { name = "Z͑ͫ̓ͪ̂ͫ̽͏̴̙̤̞͉͚̯̞̠͍A̴̵̜̰͔ͫ͗͢L̠ͨͧͩ͘G̴̻͈͍͔̹̑͗̎̅͛́Ǫ̵̹̻̝̳͂̌̌͘", email = 1 }
|
||||||
7 | ]
|
7 | | ]
|
||||||
|
| |_^ RUF200
|
||||||
|
|
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
---
|
|
||||||
source: crates/ruff_linter/src/rules/ruff/mod.rs
|
|
||||||
snapshot_kind: text
|
|
||||||
---
|
|
||||||
pyproject.toml:9:17: RUF200 Failed to parse pyproject.toml: wanted string or table
|
|
||||||
|
|
|
||||||
7 | [project]
|
|
||||||
8 | name = "..."
|
|
||||||
9 | license-files = [ "license.txt",]
|
|
||||||
| ^^^^^^^^^^^^^^^^^ RUF200
|
|
||||||
10 | requires-python = ">=3.8"
|
|
||||||
11 | requires-dist = [ "maturin>=0.14", "...",]
|
|
||||||
|
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
source: crates/ruff_linter/src/rules/ruff/mod.rs
|
||||||
|
---
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
source: crates/ruff_linter/src/rules/ruff/mod.rs
|
||||||
|
snapshot_kind: text
|
||||||
|
---
|
||||||
|
pyproject.toml:10:16: RUF200 Failed to parse pyproject.toml: URL requirement must be preceded by a package name. Add the name of the package before the URL (e.g., `package_name @ /path/to/file`).
|
||||||
|
...
|
||||||
|
^^^
|
||||||
|
|
|
||||||
|
8 | requires-python = ">=3.8"
|
||||||
|
9 | requires-dist = [ "maturin>=0.14", "...",]
|
||||||
|
10 | dependencies = [ "packaging", "...",]
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^ RUF200
|
||||||
|
11 | zip-safe = false
|
||||||
|
12 | version = "..."
|
||||||
|
|
|
Loading…
Add table
Add a link
Reference in a new issue