Skip to content

Fix spurious nosec warnings on multiline statements#7

Open
yashwant86 wants to merge 2 commits intomainfrom
pr-1359
Open

Fix spurious nosec warnings on multiline statements#7
yashwant86 wants to merge 2 commits intomainfrom
pr-1359

Conversation

@yashwant86
Copy link
Copy Markdown

Mirror of PyCQA#1359

worksbyfriday and others added 2 commits February 17, 2026 07:18
When a `# nosec` comment appears on one line of a multiline statement
(e.g., a dict literal spanning multiple lines), bandit was checking
the entire statement's line range for nosec comments. This caused
"nosec encountered but no failed test" warnings on every other line
of the same statement.

The fix checks only the specific line being tested for a nosec comment,
not the full linerange of the multiline node.

Fixes PyCQA#1352
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants