EXE001 treats an ordinary comment beginning with #! as a shebang even when it appears inside a function and does not specify an interpreter.
# test.py (not executable)
def f():
#! regular comment
return 1
$ ruff check --isolated --select EXE001 test.py
EXE001 Shebang is present but file is not executable
--> test.py:3:5
|
1 | # test.py (not executable)
2 | def f():
3 | #! regular comment
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
4 | return 1
|
Found 1 error.
This probably applies to other shebang rules too since they all share ShebangDirective::try_extract. I guess I assumed that that would filter out "shebang" lines later in the file.
EXE001treats an ordinary comment beginning with#!as a shebang even when it appears inside a function and does not specify an interpreter.This probably applies to other shebang rules too since they all share
ShebangDirective::try_extract. I guess I assumed that that would filter out "shebang" lines later in the file.