Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S113: Not identified in sessions #14102

Open
kiblik opened this issue Nov 5, 2024 · 1 comment
Open

S113: Not identified in sessions #14102

kiblik opened this issue Nov 5, 2024 · 1 comment
Labels
bug Something isn't working type-inference Requires more advanced type inference.

Comments

@kiblik
Copy link

kiblik commented Nov 5, 2024

S113 can idenify if request is missing timeout and it runs "natively". However, it does not identify run from existing sessions.

code

import requests

requests.get("https://example.com")  # violation identified - Good
requests.get("https://example.com", timeout=5)  # correct implementation

s = requests.session()
s.get("https://example.com")  # violation NOT identified - Bad
s.get("https://example.com", timeout=5)  # correct implementation

config

[lint]
select = ["S113"]

version

$ ruff --version
ruff 0.7.2
@dhruvmanila
Copy link
Member

Thanks for the issue. I don't think this is currently possible as Ruff needs to know the type of symbol s here. We're currently working on it (Red Knot project) but it'll take some time before it can be utilized.

@dhruvmanila dhruvmanila added bug Something isn't working type-inference Requires more advanced type inference. labels Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working type-inference Requires more advanced type inference.
Projects
None yet
Development

No branches or pull requests

2 participants