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()
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
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.
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.
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
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
On Flake8 2.x we added the information about the implementation,
version, and operating system to the --version output to make helping
users easier. In short they can pretty simply just give us the output
from
flake8 --version
And we can get a lot of the information that we need.
Previously, pycodestyle never introspected the argument names for
classes except to require that ``tree`` be an argument it could pass.
For Flake8 3.0, we lifted that restriction, but old plugins seem to
have cargo-culted their __init__ signature to be
def __init__(self, tree, builtins=None):
For some yet unknown reason. This was causing an AttributeError. By
updating flake8.utils.parameters_for to return a dictionary that
indicates whether the parameter is required or not, we can side-step
this by simply ignoring the parameter if it has a default value and
we cannot provide it.
Closes#151
Previously the --select was only ever populated to E,F,W,C and so
plugins would not be reported when not off-by-default. This adds a
tiny shim so that we enable plugins that are not off-by-default and
:x
:x
Previously Flake8 parsed both
max-line-length = 110
And
max_line_length = 110
From the config file without issue. When we updated our logic, I forgot
to test for that and we lost that behaviour temporarily.
Closes#152
If somebody explicitly has a `.flake8` file, presumably they intend to
put flake8 configuration in it, so prefer it to the generic `setup.cfg`
and `tox.ini` from pycodestyle.