Output examples in the CSV, JSON and YAML formatter docs are out of date
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- documentation
Research direction
Read the module docstrings in bandit/formatters/csv.py, bandit/formatters/json.py and bandit/formatters/yaml.py. Run each formatter on examples/yaml_load.py and compare its output with the examples shown on the formatter docs pages. Update the examples to match current output, including the fields and finding names described in the issue.
Written by the indexing model from the issue text.
Description
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_offsetandend_col_offset, but the formatter writes them. - JSON and YAML: the results don't have
col_offsetandend_col_offset, and the metrics don't haveskipped_tests. The YAML example also doesn't haveissue_cwe. - CSV and JSON show the
yaml.loadfinding asblacklist_calls/B301. The real output isyaml_load/B506.
Reproduction steps
- 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 - 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.
- Dominant language
- Python
- Stars
- 8.4k
- Forks
- 893
- Avg merge
- 6h 52m
- Merged PRs (30d)
- 3
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PyCQA/bandit
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Turn off progress bar in CIPossibly taken @silvatechf claimed this 28 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
`bandit -ii -ll -ii -ll` raises an `IndexError`Possibly taken @botbikamordehai2-sketch claimed this 181 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
False negative: B104 misses `bind(("", port))` wildcard hostPossibly taken @mokashang claimed this 196 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
NatLabRockies/openstudio-mcp#286 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
intersystems/ipm#1338 ·
Maintainers usually reply within 1 day
-
separate_packages splits imports from the same explicitly configured packagePossibly taken @rahul05ranjan claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 2 days
-
The v0-through-v1 path derives ShutdownDuration its own way, silently overriding a user's definitionOpenv1
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day