Herramientas de usuario

Herramientas del sitio


wiki2:python:flake8

¡Esta es una revisión vieja del documento!


Flake8

Basic usage

Documentation:

Install:

pip install flake8

To use it for a folder:

# for the current path
flake8
# or
python -m flake8
# or
flake8 /the/path

To use it for a file:

flake8 path/to/file.py

The output format is:
file path : line number : column number : error code : short description

Error code prefix:

Configuration

You can configure the flake8 analysis using its command parameters (http://flake8.pycqa.org/en/latest/user/options.html) or placing them in a file named setup.cfg in the project root.

[flake8]
exclude = .git,*migrations*
max-line-length = 119

Ignoring errors

Just add # noqa in the end of the line.

def ready(self):
    import cmdbox.profiles.signals.handlers  # noqa

Or you can pass the specific error code you want to ignore:

import cmdbox.profiles.signals.handlers  # noqa: F401

Using it with...

wiki2/python/flake8.1552896849.txt.gz · Última modificación: 2020/05/09 09:24 (editor externo)