Skip to content

Commit e27493f

Browse files
Fridayai700claudepre-commit-ci[bot]
authored
Include filename in nosec 'no failed test' warning (#1363)
* Include filename in nosec "no failed test" warning The warning about a nosec comment with no matching failed test only included the line number, making it hard to locate the issue in multi-file scans. Add the filename so the warning reads: nosec encountered (B608), but no failed test on file src/foo.py:42 Fixes #1269 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent b69b336 commit e27493f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

bandit/core/tester.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ def run_tests(self, raw_context, checktype):
112112
):
113113
LOG.warning(
114114
f"nosec encountered ({test._test_id}), but no "
115-
f"failed test on line {temp_context['lineno']}"
115+
f"failed test on file "
116+
f"{temp_context['filename']}:"
117+
f"{temp_context['lineno']}"
116118
)
117119

118120
except Exception as e:

0 commit comments

Comments
 (0)