Jump to >

Pycodestyle

New in version 2.0.

pycodestyle is a tool that checks Python code against a handful of style conventions, including those defined in PEP 8.

Supported File Types

The following are supported by this tool:

  • Python: *.py

Installation

pycodestyle can be installed on most systems by running:

$ pip install pycodestyle

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

Configuration

Pycodestyle Location

If the pycodestyle 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 = {
    'pycodestyle': '/path/to/pycodestyle',
}

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

Enabling pycodestyle 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 pycodestyle --max-line-length=....

Ignore (optional):

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

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

See the list of pycodestyle error codes for possible values.