subprocess-run-without-check
What it does
Section titled “What it does”Reports a call of subprocess.run with no check keyword. A call with **kwargs is not reported.
Why it matters
Section titled “Why it matters”By default run returns after the command fails and does not tell: the exit status is only in returncode, and a script that never reads it goes on as if the command had worked. check=True raises CalledProcessError, and check=False says that the status is read or ignored on purpose.
To fix, pass check=True, or check=False when the status is handled.
Example
Section titled “Example”... pass
...subprocess.run(["ls"])
a = b = "x"...Configuration
Section titled “Configuration”python: lint: rules: subprocess-run-without-check: warn # off (default), warn, errorEnabled by the presets: python/ruff.
Suppress one line with sudsy-disable-next-line subprocess-run-without-check in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| ruff | PLW1510 |
full |