Checker¶
Entry point to the app.
Represents a checker business entity. There’s only a single checker instance that runs a lot of visitors.
Checker relation with visitors.¶
That’s how all flake8 plugins work:
flake8 API calls order.¶
Checker API¶
-
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:
wemake_python_styleguide.options.config.Configuration.
-
options¶ option structure passed by
flake8:wemake_python_styleguide.types.ConfigurationOptions.
-
__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) –astparsed byflake8. Differs fromast.parsesince it is mutated by multipleflake8plugins. Why mutated? Since it is really expensive to copy allastinformation in terms of memory. - file_tokens (
Sequence[TokenInfo]) –tokenize.tokenizeparsed file tokens. - filename (
str) – module file name, might be empty if piping is used.
Return type: None- tree (
-
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
-