mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
[flake8-executable
] Allow uvx
in shebang line (EXE003
) (#18967)
## Summary closes #18902 ## Test Plan I have added a test case
This commit is contained in:
parent
db3dcd8ad6
commit
d78f18cda9
6 changed files with 20 additions and 1 deletions
2
crates/ruff_linter/resources/test/fixtures/flake8_executable/EXE003_uv_tool.py
vendored
Executable file
2
crates/ruff_linter/resources/test/fixtures/flake8_executable/EXE003_uv_tool.py
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env -S uv tool run ruff check --isolated --select EXE003
|
||||
print("hello world")
|
2
crates/ruff_linter/resources/test/fixtures/flake8_executable/EXE003_uvx.py
vendored
Executable file
2
crates/ruff_linter/resources/test/fixtures/flake8_executable/EXE003_uvx.py
vendored
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env -S uvx ruff check --isolated --select EXE003
|
||||
print("hello world")
|
|
@ -22,6 +22,8 @@ mod tests {
|
|||
#[test_case(Path::new("EXE002_3.py"))]
|
||||
#[test_case(Path::new("EXE003.py"))]
|
||||
#[test_case(Path::new("EXE003_uv.py"))]
|
||||
#[test_case(Path::new("EXE003_uv_tool.py"))]
|
||||
#[test_case(Path::new("EXE003_uvx.py"))]
|
||||
#[test_case(Path::new("EXE004_1.py"))]
|
||||
#[test_case(Path::new("EXE004_2.py"))]
|
||||
#[test_case(Path::new("EXE004_3.py"))]
|
||||
|
|
|
@ -47,7 +47,12 @@ pub(crate) fn shebang_missing_python(
|
|||
shebang: &ShebangDirective,
|
||||
context: &LintContext,
|
||||
) {
|
||||
if shebang.contains("python") || shebang.contains("pytest") || shebang.contains("uv run") {
|
||||
if shebang.contains("python")
|
||||
|| shebang.contains("pytest")
|
||||
|| shebang.contains("uv run")
|
||||
|| shebang.contains("uvx")
|
||||
|| shebang.contains("uv tool run")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_executable/mod.rs
|
||||
---
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/flake8_executable/mod.rs
|
||||
---
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue