For the sake of IDEs, check filename for exclusion even if the file is directly
named in the command line.
Also, if the filename is "-" (stdin) check the provided display name for
exclusion.
Also, avoid calling path checking functions on the "-" filename:
* fnmatch.fnmatch()
* os.path.isdir()
* os.path.exists()
Document flake8-polyfill in compatibility section
*Description of changes*
Document the existence and usage of the flake8-polyfill section.
Closes: #158Closes: #161Closes: #167
See merge request !77
Yesterday we released the flake8-polyfill package to help with Flake8
compatibility issues. This adds documentation to Flake8 to help people
use that and to guide them towards it.
Fix git config parsing
Because the `git config --get --bool <option>` external command adds an extraneous newline for readability purposes, that character need to be stripped for proper parsing.
*Related to:* #170
See merge request !75
Since the "git config" command adds a newline to the end of its output, the extraneous whitespace needs to be stripped out for proper parsing.
Fixes#170
Add OptionManager#parse_known_args
*Description of changes*
Add `parse_known_args` to our `OptionManager` interface so plugin flags can be specified. This provides similar behaviour to argparse's `parse_known_args` method on its `ArgumentParser`. When we transition to argparse, we'll be able to take direct advantage of that.
*Related to:* #168
See merge request !74
If a user specified `--max-complexity` on the command-line, they
would be told that it did not exist. The same would be true of any
option provided by a plugin. This is because we parse the command-line
arguments twice in Flake8 -- the first time to specify the verbosity
and destination for logging, the second time to actually execute Flake8.
Since plugin options are not registered to start with the first time,
they are not valid options. So when we first parse the options, we should
only attempt to parse the ones which we know about.
Closes#168
If users do `from flake8.api.legacy import *` we only want them to get
get_style_guide imported. The other classes are not meant to be created
by users.
We need to initialize part of the Application so we can set options
passed by the user, but we also want to delay making things, e.g.,
- Formatter
- Style Guide
- etc.
Until we have the options solidified so we don't have to do annoying
things.
Add the statistics module
*Description of changes*
Start adding support for `--statistics` and legacy `get_statistics` API.
*Related to:* (Add bug number here)
See merge request !73
Also refactor our statistics module to be a bit smarter and less
namedtuple happy. The Statistic class had no reason to be a tuple,
I have no clue why I wrote it that way last night.
Handle errors reported in empty files
*Description of changes*
Some plugins return errors in empty files which previously caused an IndexError.
*Related to:* #157
See merge request !71
Some plugins (e.g., flake8-future-import) report errors for empty
files. Those plugins default to reporting the line number as 1 which
caused earlier versions of Flake8 3.0 beta to crash on an IndexError
Closes#157
Add empty file as a test fixture
*Description of changes*
Related to a bug earlier this week. Add an empty file as a test fixture to make sure we don't break on empty files.
*Related to:* #157
See merge request !70
Add new Flake8 classifier to Trove list
*Description of changes*
PyPI added `Framework :: Flake8` to its list of official classifiers. This adds it to the documentation for Plugin Developers.
*Related to:* N/A
See merge request !69
Update setuptools integration for setup.cfg
*Description of changes*
Allow setuptools to parse config options from setup.cfg and pass them along via the attributes on our Flake8 command.
*Related to:* #163
See merge request !67
When calling `add_option` it returns an `Option` object which can return the
primary name of the option via `get_opt_name`. This should be used primarily
in the cross compatible implementation so that the order of parameters does
not matter.
When flake8's config is in setup.cfg, setuptools attempts to set those
options on the command instance. If they don't exist, it fails early
complaining that a specific option does not exist.
This adds this back and does it better than the Flake8 2.x version.
Closes#163
Backwards Compatibility API
*Description of changes*
Add `flake8.api.legacy` to replace `flake8.engine`'s public API.
*Related to:* N/A
See merge request !66