Skip to content

Commit 8cfe319

Browse files
committed
flake8-executable: allow global flags in uv shebangs (EXE003)
1 parent b07a53a commit 8cfe319

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
#!/usr/bin/env -S uv run
22
print("hello world")
33

4+
#!/usr/bin/env uv --quiet run
5+
#!/usr/bin/env uv --offline run

crates/ruff_linter/src/rules/flake8_executable/rules/shebang_missing_python.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub(crate) fn shebang_missing_python(
5050
) {
5151
if shebang.contains("python")
5252
|| shebang.contains("pytest")
53-
|| shebang.contains("uv run")
53+
|| (shebang.contains("uv") && shebang.contains("run"))
5454
|| shebang.contains("uvx")
5555
|| shebang.contains("uv tool run")
5656
{
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
---
22
source: crates/ruff_linter/src/rules/flake8_executable/mod.rs
33
---
4+
EXE005 Shebang should be at the beginning of the file
5+
--> EXE003_uv.py:4:1
6+
|
7+
2 | print("hello world")
8+
3 |
9+
4 | #!/usr/bin/env uv --quiet run
10+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11+
5 | #!/usr/bin/env uv --offline run
12+
|
413

14+
EXE005 Shebang should be at the beginning of the file
15+
--> EXE003_uv.py:5:1
16+
|
17+
4 | #!/usr/bin/env uv --quiet run
18+
5 | #!/usr/bin/env uv --offline run
19+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+
|

0 commit comments

Comments
 (0)