@@ -6,17 +6,17 @@ use ruff_macros::{derive_message_formats, ViolationMetadata};
6
6
use crate :: comments:: shebang:: ShebangDirective ;
7
7
8
8
/// ## What it does
9
- /// Checks for a shebang directive in `.py` files that does not contain `python`.
9
+ /// Checks for a shebang directive in `.py` files that does not contain `python`,
10
+ /// `pytest`, or `uv run`.
10
11
///
11
12
/// ## Why is this bad?
12
13
/// In Python, a shebang (also known as a hashbang) is the first line of a
13
- /// script, which specifies the interpreter that should be used to run the
14
+ /// script, which specifies the command that should be used to run the
14
15
/// script.
15
16
///
16
- /// For Python scripts, the shebang must contain `python` to indicate that the
17
- /// script should be executed as a Python script. If the shebang does not
18
- /// contain `python`, then the file will be executed with the default
19
- /// interpreter, which is likely a mistake.
17
+ /// For Python scripts, if the shebang does not include a command that explicitly
18
+ /// or implicitly specifies an interpreter, then the file will be executed with
19
+ /// the default interpreter, which is likely a mistake.
20
20
///
21
21
/// ## Example
22
22
/// ```python
@@ -45,7 +45,7 @@ pub(crate) fn shebang_missing_python(
45
45
range : TextRange ,
46
46
shebang : & ShebangDirective ,
47
47
) -> Option < Diagnostic > {
48
- if shebang. contains ( "python" ) || shebang. contains ( "pytest" ) {
48
+ if shebang. contains ( "python" ) || shebang. contains ( "pytest" ) || shebang . contains ( "uv run" ) {
49
49
return None ;
50
50
}
51
51
0 commit comments