Network call without a timeout
This is how the comment reads inline, under the flagged line.
Why it matters
Without a timeout one stuck upstream holds a worker until the process dies. At scale that becomes an outage.
What to do
Pass timeout= (and retry with backoff if the call is idempotent).
Examples
requests.get(url)
requests.get(url, timeout=10)
What it catches
It reads a pattern on each line, aware of strings and comments. Languages: Python. Scope: All files. These cases are the rule's own tests: the first set must be flagged and the second must not.
Flagged
r = requests.get(url)
Left alone
r = requests.get(url, timeout=5)
Research
Network calls with no timeout or abort signal. One slow upstream can hang a worker forever.
- Ruff rules
- AI code audit taxonomy
- skill: code-review
Turn it off or change it
In a config file for the CLI, or in the API's rules field:
{
"rules": {
"disable": [
"missing-timeout"
],
"severity": {
"missing-timeout": "low"
}
}
}
requests.gethas no timeout, so a slow server can hang this forever.