Skip to content

fix(lint): Close S016 loophole for attribute-access ThreadPoolExecutor#112170

Merged
gricha merged 1 commit into
masterfrom
s016-attribute-access-loophole
Apr 2, 2026
Merged

fix(lint): Close S016 loophole for attribute-access ThreadPoolExecutor#112170
gricha merged 1 commit into
masterfrom
s016-attribute-access-loophole

Conversation

@gricha
Copy link
Copy Markdown
Member

@gricha gricha commented Apr 2, 2026

S016 only caught from concurrent.futures import ThreadPoolExecutor (the ImportFrom AST node). Writing import concurrent.futures then using concurrent.futures.ThreadPoolExecutor(...) bypassed the rule entirely.

This adds a check in visit_Attribute that matches when the attribute chain is exactly concurrent.futures.ThreadPoolExecutor — catches both calls and bare references, without flagging other concurrent.futures.* usage like as_completed or Future.

Also fixes the one existing violation in src/sentry/build/_integration_docs.py.

Stacks on #112156.

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 2, 2026
@gricha gricha force-pushed the s016-attribute-access-loophole branch from 50c8370 to b469d8f Compare April 2, 2026 21:05
@gricha gricha changed the base branch from viewer-context-definition to master April 2, 2026 21:05
S016 only checked `from concurrent.futures import ThreadPoolExecutor`. Writing `import concurrent.futures` then `concurrent.futures.ThreadPoolExecutor()` bypassed it entirely. Add a check in visit_Attribute that matches the full attribute chain. Fix one existing violation in the build script.

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
@gricha gricha force-pushed the s016-attribute-access-loophole branch from b469d8f to c1fd600 Compare April 2, 2026 21:08
@gricha gricha marked this pull request as ready for review April 2, 2026 21:14
@gricha gricha requested review from a team as code owners April 2, 2026 21:14
@gricha gricha merged commit 7dd4e50 into master Apr 2, 2026
72 of 74 checks passed
@gricha gricha deleted the s016-attribute-access-loophole branch April 2, 2026 21:41
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants