When running code that has a nosec line that specifes a test these lines are not counted in the "Total lines skipped" metric in the summary
Reproduction steps
1. Create foo.py with this content:
table = "my_table"
query = "SELECT * FROM {} WHERE True".format(table) # nosec B608
2. Run `bandit foo.py` from the shell
3. At the end of the run observe the summary and notice the `Total lines skipped` is 0
❯ bandit blah.py
[main] INFO profile include tests: None
[main] INFO profile exclude tests: None
[main] INFO cli include tests: None
[main] INFO cli exclude tests: None
[main] INFO running on Python 3.12.7
Run started:2024-11-21 17:22:51.993562
Test results:
No issues identified.
Code scanned:
Total lines of code: 2
Total lines skipped (#nosec): 0
Run metrics:
Total issues (by severity):
Undefined: 0
Low: 0
Medium: 0
High: 0
Total issues (by confidence):
Undefined: 0
Low: 0
Medium: 0
High: 0
Files skipped (0):
Expected behavior
The Total lines skipped should be 1 just like when you use a bare #nosec
Describe the bug
When running code that has a nosec line that specifes a test these lines are not counted in the "Total lines skipped" metric in the summary
Reproduction steps
Expected behavior
The
Total lines skipped
should be 1 just like when you use a bare#nosec
Bandit version
1.7.10 (Default)
Python version
3.12
Additional context
No response