Entry point to the app.

Represents a checker business entity. There’s only a single checker instance that runs a lot of visitors.

graph TD C1[Checker] --> V1[Visitor 1] C1[Checker] --> V2[Visitor 2] C1[Checker] --> VN[Visitor N]

Checker relation with visitors.

That’s how all flake8 plugins work:

graph LR F1[flake8] --> F2[add_options] F2 --> F3[parse_options] F3 --> F4[__init__] F4 --> F5[run]

flake8 API calls order.

Checker API

class Checker(tree, file_tokens, filename='stdin')[source]

Bases: object

Implementation of checker.


required by the flake8 API, should match the package name.


required by the flake8 API, defined in the packaging file.


custom configuration object used to provide and parse options:


option structure passed by flake8:


preset of visitors that are run by this checker.

__init__(tree, file_tokens, filename='stdin')[source]

Creates new checker instance.

These parameter names should not be changed. flake8 has special API that passes concrete parameters to the plugins that ask for them.

flake8 also decides how to execute this plugin based on its parameters. This one is executed once per module.

  • tree (AST) – ast tree parsed by flake8.

  • file_tokens (Sequence[TokenInfo]) – tokenize.tokenize parsed file tokens.

  • filename (str) – module file name, might be empty if piping is used.

Return type