Jump to >

Flake8

flake8 is a wrapper around several Python code quality tools (including Pycodestyle and Pyflakes), which checks for errors or formatting inconsistencies in Python source code.

Supported File Types

The following are supported by this tool:

  • Python: *.py

Installation

flake8 can be installed on most systems by running:

$ pip install flake8

It may also be available in your system’s package manager.

Configuration

Flake8 Location

If the flake8 command is in a non-standard location, and can’t be found in Review Bot’s PATH environment variable, then you’ll need to specify the path in the Review Bot worker config file:

exe_paths = {
    'flake8': '/path/to/flake8',
}

You will need to restart the Review Bot worker after making this change.

Enabling Flake8 in Review Board

First, you’ll need to add a Review Bot configuration in Review Board (see Tool Configurations).

The following configuration options are available:

Maximum line length (required):

The maximum length allowed for lines. Any lines longer than this length will cause an issue to be filed.

The default is 79.

This is equivalent to flake8 --max-line-length=....

Ignore (optional):

A comma-separated list of error or warning codes to ignore.

This is equivalent to flake8 --ignore=....