Checker¶
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¶
- final class Checker(tree, file_tokens, filename='stdin')[source]¶
Bases:
objectImplementation of checker.
- name¶
required by the
flake8API, should match the package name.
- version¶
required by the
flake8API, defined in the packaging file.
- config¶
custom configuration object used to provide and parse options:
- :class:`wemake_python_styleguide.options.config.Configuration`.
- options¶
option structure passed by
flake8:
- :class:`wemake_python_styleguide.options.validation.ValidatedOptions`.
- __init__(tree, file_tokens, filename='stdin')[source]¶
Creates new checker instance.
These parameter names should not be changed.
flake8has special API that passes concrete parameters to the plugins that ask for them.flake8also decides how to execute this plugin based on its parameters. This one is executed once per module.- Parameters:
tree (
AST) –asttree parsed byflake8.file_tokens (
Sequence[TokenInfo]) –tokenize.tokenizeparsed file tokens.filename (
str) – module file name, might be empty if piping is used.
- classmethod add_options(parser)[source]¶
flake8api method to register new plugin options.See
wemake_python_styleguide.options.config.Configurationdocs for detailed options reference.- Parameters:
parser (
OptionManager) –flake8option parser instance.- Return type:
None