bandit icon indicating copy to clipboard operation
bandit copied to clipboard

Output examples in the CSV, JSON and YAML formatter docs are out of date

Open Dio77799 opened this issue 3 weeks ago • 2 comments

Describe the bug

The output examples in the module docstrings of bandit/formatters/csv.py, json.py and yaml.py (shown on the "Report formatters" docs pages) don't match what Bandit prints today:

  • CSV: the header doesn't have col_offset and end_col_offset, but the formatter writes them.
  • JSON and YAML: the results don't have col_offset and end_col_offset, and the metrics don't have skipped_tests. The YAML example also doesn't have issue_cwe.
  • CSV and JSON show the yaml.load finding as blacklist_calls / B301. The real output is yaml_load / B506.

Reproduction steps

  1. From a checkout of the repo, run: bandit -f csv examples/yaml_load.py bandit -f json examples/yaml_load.py bandit -f yaml examples/yaml_load.py
  2. Compare the output with the examples on the CSV, JSON and YAML formatter docs pages.

Expected behavior

The examples in the docs match the current output of each formatter.

Bandit version

1.9.5.dev23 (main)

Python version

3.14

Additional context

PRs are limited to collaborators, so I regenerated the three examples from the real output of examples/yaml_load.py on a branch on my fork (docstrings only): https://github.com/PyCQA/bandit/compare/main...Dio77799:bandit:docs/formatter-examples

The XML example has the same blacklist_calls / B301 problem. I didn't touch it here because my branch for #1304 changes that same docstring.

Dio77799 avatar Nov 08 '26 19:11 Dio77799

Rechecked main: csv.py still lists the header without col_offset and end_col_offset (lines 14 and 15), and the writer adds them (lines 65 and 66). Nothing under bandit/formatters has changed since Sep 2025, so the diff in my branch still applies as is. Since I can't open PRs, would one of you be up for cherry picking it? If you'd rather split it per formatter, I can do that.

Dio77799 avatar Nov 19 '26 06:11 Dio77799

Hello,

I'm interested in contributing to Bandit as a new Python open-source contributor. I've reviewed the contribution guide and started working through the codebase.

I've noticed that pull-request creation is currently restricted to collaborators, and that several contributors have prepared fixes on their forks but cannot submit them directly.

Is there an alternative process for external contributors? For example, could maintainers review a fork branch, cherry-pick a proposed commit, or enable pull requests for an approved contribution?

I'd be happy to follow whatever review and testing process the project prefers.

Thank you.

ItsElarumi avatar Nov 23 '26 22:11 ItsElarumi