Formatters

Formatters make errors output nice. Available formatters:

  • colored – for humans.
  • gitlab – Gitlab CI Code Quality artifact.
  • grouped – also colored, but all messages are explicitly grouped by file.
  • json – no colors, only one json-dict per line for every error.
  • stat – show errors count for every code, grouped by plugins.
  • default – classic Flake8 formatter. Booooring.

Also, you can specify show_source = true in the config to show line of source code where error occurred with syntax highlighting.

Colored

[tool.flakehell]
format = "colored"

_images/colored.pngoutput of colored formatter

Colored with source code

[tool.flakehell]
format = "colored"
show_source = true

_images/colored-source.pngoutput of colored formatter with source code

Grouped

[tool.flakehell]
format = "grouped"

_images/grouped.pngoutput of grouped formatter

Grouped with source code

[tool.flakehell]
format = "grouped"
show_source = true

_images/grouped-source.pngoutput of grouped formatter with source code

Stat

[tool.flakehell]
format = "stat"

_images/stat.pngoutput of stat formatter

JSON

[tool.flakehell]
format = "json"

_images/json.pngoutput of json formatter

Gitlab

Output Code Quality artifact compatible with Gitlab CI.

[tool.flakehell]
format = "gitlab"

An example of Gitlab CI job (.gitlab-ci.yml):

flakehell:
  image: python:3.7
  script:
    - pip3 install flakehell
    - flakehell lint --format=gitlab --output-file flakehell.json
  artifacts:
    reports:
      codequality: flakehell.json