Skip to main content

Flake8 wrapper to make it nice and configurable

Project description

It’s a Flake8 wrapper to make it cool.

  • Use only specified plugins, not everything installed.

  • Manage codes per plugin.

  • Enable and disable plugins and codes by wildcard.

  • Make output beautiful.

  • Show codes for installed plugins.

  • Show all messages and codes for a plugin.

  • Check that all required plugins are installed.

  • Syntax highlighting in messages and code snippets.

  • pyproject.toml support

  • sharable and remote configs.

output example

Installation

python3 -m pip install --user flakehell

Usage

First of all, let’s create pyproject.toml config:

[tool.flakehell]
# optionally inherit from remote config (or local if you want)
base = "https://gitlab.com/life4/flakehell/raw/master/pyproject.toml"
# specify any flake8 options. For example, exclude "example.py":
exclude = ["example.py"]
# make output nice
format = "grouped"
# 80 chars aren't enough in 21 century
max_line_length = 90
# show line of source code in output
show_source = true

# list of plugins and rules for them
[tool.flakehell.plugins]
# include everything in pyflakes except F401
pyflakes = ["+*", "-F401"]
# enable only codes from S100 to S199
flake8-bandit = ["-*", "+S1**"]
# enable everything that starts from `flake8-`
"flake8-*" = ["+*"]
# explicitly disable plugin
flake8-docstrings = ["-*"]
  • You can specify any flake8 settings in [tool.flakehell].

Show plugins that aren’t installed yet:

flakehell missed

Show installed plugins, used plugins, specified rules, codes prefixes:

flakehell plugins
plugins command output

Show codes and messages for a specific plugin:

flakehell codes pyflakes
codes command output

Run flake8 against the code:

flakehell lint

This command accepts all the same arguments as Flake8.

Formatters

Formatters make errors output nice. Available formatters:

  • colored – for humans.

  • grouped – also colored, but all messages are explicitly grouped by file.

  • json – no colors, only one json-dict per line for every error.

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

Colored:

colored

Colored with source code:

colored

Grouped:

grouped

Grouped with source code:

grouped

JSON:

json

Integrating into huge codebase

First of all, let’s create baseline.

Config:

[tool.flakehell]
format = "baseline"

Run:

python3 -m flakehell lint > baseline.txt

Then restore your default format and specify path to the baseline file:

[tool.flakehell]
baseline = "baseline.txt"
format = "grouped"

Now, flakehell lint command will ignore all your current errors. It will report only about new errors, all errors in a new code, or if old line of code was modified.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flakehell-0.1.2.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

flakehell-0.1.2-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file flakehell-0.1.2.tar.gz.

File metadata

  • Download URL: flakehell-0.1.2.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for flakehell-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5b5a679e3b9370920642bbcda856b0dd41cc98e476e6d7b7e0ea8a23b3870ea0
MD5 01b3a060e3ded8b10d4f8aa31935f57e
BLAKE2b-256 2c1fc3a65a18679597447e9eda24fca93cd4de2bd1a363fee3dd2f57c376d1cb

See more details on using hashes here.

File details

Details for the file flakehell-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: flakehell-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7

File hashes

Hashes for flakehell-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9bfe52b10dd21d37a2c747c60aa0b0a5deb73344669b3de4160ab5be675032d8
MD5 c17e4621f8ce94cb8b4003f83dde03ff
BLAKE2b-256 33e0771f27a3ce7f8156d301652bc09e588e682010c7f54570edf4cce3d85a9c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page