pep8's checker has the noqa logic which we've correctly placed on the
StyleGuide object. By passing the StyleGuide in to our checkers we can
have the checkers pass the physical line to the StyleGuide so we can
eliminate our usage of linecache.
This separates concerns so that the check runner can rely on the file
processor to store state and such. It introduces two logical
collaborators and will allow us to keep feature parity with flake8 2's
plugin design (where it could request any attribute from pep8.Checker).
- Add more documentation around utils functions
- Fix documentation about default formatting plugins
- Add extra documentation of filenames_from predicate parameter
- Add test for the default parameter of flake8.utils.fnmatch
Flake8 has previously only ever relied on the first member of the
parameters list to determine what kind of check it is using. As such,
we constrain ourselves to just that parameter when checking and add
properties for ast and logical line checks.
Flake8 and pep8 has historically supported three types of checks:
- Plugins that accept the physical line
- Plugins that accept the logical line
- Plugins that accept the AST tree
The logical place to make this distinction is on the Checkers plugin
type manager class. This adds the foundation for finding plugins that
fall into each class.
We add utils.fnmatch and utils.filenames_for in anticipation of our
checker manager creating file checkers for each file. We also include
tests for these functions and a couple previously untested utility
functions.
There are still kinks to be worked out but this works reasonably well.
This will fail until we can figure out how to import things from the
typing module for the type: comments only. We do not want to add a
dependency on that backport only for this mypy env.