Development Skills
  • Development Skills
  • Server-side
    • Reverse SSH
    • Let's encrypt with Nginx
    • Miniconda
    • OpenSSL
    • Windows Skills
    • Crobtab
  • Set up Workspace
    • Setup basic environment
  • Bandit - Check your code's safeness
    • Introduction
    • Getting Started
    • Usage
    • Banditfile
    • Tailor-made testing
    • Tailor-made blacklist
    • Tailor-made formatter
    • Reference
Powered by GitBook
On this page
  • Example Formatter
  • Complete Formatter Listing
  1. Bandit - Check your code's safeness

Tailor-made formatter

PreviousTailor-made blacklistNextReference

Last updated 6 years ago

Bandit supports many different formatters to output various security issues in python code. These formatters are created as plugins and new ones can be created to extend the functionality offered by bandit today.

Example Formatter

def report(manager, fileobj, sev_level, conf_level, lines=-1):
    result = bson.dumps(issues)
    with fileobj:
        fileobj.write(result)

To register your plugin, you have two options:

  1. If you’re using setuptools directly, add something like the following to your setup call:

    # If you have an imaginary bson formatter in the bandit_bson module
    # and a function called `formatter`.
    entry_points={'bandit.formatters': ['bson = bandit_bson:formatter']}
  2. If you’re using pbr, add something like the following to your setup.cfg file:

    [entry_points]
    bandit.formatters =
        bson = bandit_bson:formatter

Complete Formatter Listing

csv
custom
html
json
screen
text
xml
yaml