Skip to content

Avoid full report when all files are skipped#1430

Open
Himanshuagrawal4 wants to merge 1 commit into
PyCQA:mainfrom
Himanshuagrawal4:PRO/bandit-skipped-files-report
Open

Avoid full report when all files are skipped#1430
Himanshuagrawal4 wants to merge 1 commit into
PyCQA:mainfrom
Himanshuagrawal4:PRO/bandit-skipped-files-report

Conversation

@Himanshuagrawal4

Copy link
Copy Markdown

Fixes #1008

Summary

  • avoid printing a full scan report when every target is skipped
  • keep normal report output unchanged when at least one file is scanned
  • add functional and formatter unit coverage for skipped-only output

Why

When Bandit was run against a missing file, it printed "No issues identified" along with zero scanned lines before listing the skipped file. That made it look like the file had been scanned successfully.

Validation

  • python -m unittest tests.functional.test_runtime tests.unit.formatters.test_text tests.unit.formatters.test_screen
  • python -m flake8 bandit\formatters\text.py bandit\formatters\screen.py tests\functional\test_runtime.py tests\unit\formatters\test_text.py tests\unit\formatters\test_screen.py
  • git diff --check

@Himanshuagrawal4 Himanshuagrawal4 marked this pull request as ready for review June 1, 2026 07:20
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.

Extra results printed, when running bandit on file that doesnt exist

1 participant