Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 2.27 KB

checker.rst

File metadata and controls

70 lines (48 loc) · 2.27 KB

How Checks are Run

In 2.x, delegated check running to pep8. In 3.0 takes on that responsibility. This has allowed for simpler handling of the --jobs parameter (using multiprocessing) and simplified our fallback if something goes awry with concurency. At the lowest level we have a ~flake8.checker.FileChecker. Instances of ~flake8.checker.FileChecker are created for each file to be analyzed by . Each instance, has a copy of all of the plugins registered with setuptools in the flake8.extension entry-point group.

The ~flake8.checker.FileChecker instances are managed by an instance of ~flake8.checker.Manager. The ~flake8.checker.Manager instance handles creating sub-processes with multiprocessing module and falling back to running checks in serial if an operating system level error arises. When creating ~flake8.checker.FileChecker instances, the ~flake8.checker.Manager is responsible for determining if a particular file has been excluded.

Processing Files

Unfortunately, since took over check running from pep8/pycodestyle, it also had to take over parsing and processing files for the checkers to use. Since it couldn't reuse pycodestyle's functionality (since it did not separate cleanly the processing from check running) that function was isolated into the ~flake8.processor.FileProcessor class. We moved several helper functions into the flake8.processor module (see also Processor Utility Functions <processor_utility_functions>).

API Reference

flake8.checker.FileChecker

flake8.checker.Manager

flake8.processor.FileProcessor

Utility Functions

flake8.processor.count_parentheses

flake8.processor.expand_indent

flake8.processor.is_eol_token

flake8.processor.is_multiline_string

flake8.processor.log_token

flake8.processor.mutate_string

flake8.processor.token_is_comment

flake8.processor.token_is_newline