Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@
os.system(["/bin/ls"])
os.system(["/bin/ls", "/tmp"])
os.system(r"C:\\bin\ls")

# Regression for https://github.com/astral-sh/ruff/issues/24075
# Check that "partial path" checks tuples too
import subprocess
subprocess.run(("echo", "foo"))
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,9 @@ fn is_full_path(text: &str) -> bool {
/// partial path.
fn is_partial_path(expr: &Expr) -> bool {
let string_literal = match expr {
Expr::List(ast::ExprList { elts, .. }) => elts.first().and_then(string_literal),
Expr::List(ast::ExprList { elts, .. }) | Expr::Tuple(ast::ExprTuple { elts, .. }) => {
elts.first().and_then(string_literal)
}
_ => string_literal(expr),
};
string_literal.is_some_and(|text| !is_full_path(text))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,12 @@ S607 Starting a process with a partial executable path
38 |
39 | # Check it does not fail for full paths.
|

S607 Starting a process with a partial executable path
--> S607.py:49:16
|
47 | # Check that "partial path" checks tuples too
48 | import subprocess
49 | subprocess.run(("echo", "foo"))
| ^^^^^^^^^^^^^^^
|
Loading