astral-sh / astral-sh/ruff

S113 only considers `timeout=` probable, unpacking is not recognised.

Open
#9,749 3 comments 1 reaction 0 assignees View on GitHub
question
Dominant language
Rust
Stars
49.6k
Forks
2.4k
Avg merge
2d 1h
Merged PRs (30d)
458

Description

Rule [S113](https://docs.astral.sh/ruff/rules/request-without-timeout/#request-without-timeout-s113) does not consider anything except a hard-coded `request=` to be "probable". This can be frustrating when one has a lot of configuration which is shared between many `requests` calls.

```python
from typing import TypedDict
import requests

requests.post('test', **{"timeout": 1000})

class Options(TypedDict):
timeout: int

options: Options = {"timeout": 1000}

requests.post('test', **options)
```

`ruff --select S113 --isolated test.py`

> test.py:4:1: S113 Probable use of requests call without timeout
> test.py:11:1: S113 Probable use of requests call without timeout
> Found 2 errors.

Version: ruff 0.1.15

Contributor guide

Open the contributing guide

Research direction

Start with the test.py reproduction and the S113 rule documentation, then run `ruff --select S113 --isolated test.py` to confirm the current diagnostics. Trace how S113 identifies probable timeout arguments, including the shown `**` unpacking cases. Done means unpacked mappings with a timeout are handled according to the intended rule behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.