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

Aperta Adatta ai principianti
#1,485 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
1-3 ore
Idoneità per principianti
85/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
documentation

Direzione di ricerca

Leggi le docstring dei moduli in bandit/formatters/csv.py, bandit/formatters/json.py e bandit/formatters/yaml.py. Esegui ogni formatter su examples/yaml_load.py e confronta il suo output con gli esempi mostrati nelle pagine della documentazione dei formatter. Aggiorna gli esempi in modo che corrispondano all’output attuale, inclusi i campi e i nomi dei finding descritti nell’issue.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
8.4k
Fork
893
Merge medio
6h 52m
PR unite (30g)
3

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PyCQA/bandit

Tutte le issue di PyCQA/bandit

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.