Commit graph

47 commits

Author SHA1 Message Date
Anthony Sottile
31c2f9f366 treat --extend-exclude as a file list 2020-05-21 16:41:02 -07:00
Eric N. Vander Weele
e6d8a90e5d options: Forward --output-file to be reparsed for BaseFormatter
This fixes a regression introduced in daca2c8 and b14d47b.

The --output-file` option was consumed by the preliminary option parser.
However, the `BaseFormatter` class needs the option for setting the
output filename.  This special cases this option to ensure it gets
re-parsed and respected when specified on the CLI.
2020-05-11 22:17:52 -07:00
Anthony Sottile
609010ce7a Fix logical checks which report position out of bounds 2020-05-07 11:16:00 -07:00
Anthony Sottile
93a17a806d instrument coverage on tests and require 100% coverage there 2020-03-23 12:15:29 -07:00
Anthony Sottile
28797a57d8 Allow noqa to apply to lines due to continuation 2020-03-17 22:12:56 -07:00
Anthony Sottile
d583f051ed Merge branch 'file_not_found_error' into 'master'
Ensure that a not-found file produces an error

Closes #600

See merge request pycqa/flake8!404
2020-01-16 22:59:38 +00:00
Anthony Sottile
32c7ebcd7b split lines the same when read from stdin 2020-01-16 14:10:33 -08:00
Anthony Sottile
bfb79b46c8 Ensure that a not-found file produces an error
- this restores a flake8 2.x behaviour that was lost in the refactor
2020-01-16 12:53:37 -08:00
Eric N. Vander Weele
eb6698c420 config: Make ConfigFileFinder 'extra_config_files' parameter optional
This simplifies the number of required parameters needed for the
`ConfigFileFinder` object throughout the various tests.
2020-01-12 23:28:52 -05:00
Eric N. Vander Weele
1e3bad20dd Remove unused 'cli_config' parameter
Now that `ConfigFileFinder.config_file` attribute is used everywhere and
is constructed from the `--config` CLI option, the now unused
`cli_config` parameters can be safely removed.
2020-01-12 23:19:26 -05:00
Eric N. Vander Weele
77b2506071 config: Switch code paths to use 'ConfigFileFinder.config_file'
Now that the `ConfigFileFinder` has the `.config_file` attribute, switch
the relevant code paths to utilize this public attribute.

Tests have been updated to either construct `ConfigFileFinder` or mock
the object appropriately.
2020-01-12 23:19:26 -05:00
Eric N. Vander Weele
c918e72496 Remove unused 'isolated' parameter
Now that `ConfigFileFinder.ignore_config_files` attribute is used
everywhere and is constructed from the `--isolated` CLI option, the now
unused `isolated` parameters can be safely removed.
2020-01-07 13:14:34 -05:00
Eric N. Vander Weele
3d546d448a config: Switch code paths to use 'ConfigFileFinder.ignore_config_files'
Now that the `ConfigFileFinder` has the `.ignore_config_files`
attribute, switch the relevant code paths to utilize this public
attribute.

Tests have been updated to either construct `ConfigFileFinder` or mock
the object appropriately.
2020-01-07 13:03:34 -05:00
Eric N. Vander Weele
738c8490ec tests: Add integration tests for --config and --isolated
Prevent regressions by adding integration tests to ensure that these
options are passed through to `aggregator.aggregate_options()`.
2019-12-29 19:17:31 -05:00
Eric N. Vander Weele
7f9f70064c aggregator: Forward --config and --isolated options during aggregation
This fixes a regression introduced in !346 to ensure that `--config` and
`--isolated` are recognized in `aggregate_options()`.

The regression manifested because `aggregate_options()` was relying on
re-parsing `argv` to obtain the option values.  However, !346 changed
the preliminary parsing logic to only parse and "eat" what is necessary
and forward along the options needed before all the configuration was
loaded.  This code path was overlooked because the tests in
`test_aggregator()` were passing but the call from the `Application`
object would never have these options in the remaining `argv` list to be
passed long.
2019-12-29 18:07:51 -05:00
Anthony Sottile
d3c95f00d0 Switch from entrypoints to importlib_metadata 2019-11-28 17:30:52 -08:00
Anthony Sottile
b14d47b356 Merge branch 'separate-prelim-options' into 'master'
Separate pre-configuration CLI parsing

See merge request pycqa/flake8!364
2019-10-31 21:05:07 +00:00
Anthony Sottile
7441c63de8 Merge branch 'specific_noqa_pycodestyle' into 'master'
Do not pass `noqa` to plugins, have flake8 decide whether to report

Closes #552

See merge request pycqa/flake8!331
2019-10-28 16:51:09 +00:00
Eric N. Vander Weele
a90200353e application: Register preliminary options on a separate argument parser
We introduce a new `ArgumentParser` for registering the preliminary
options to be inherited by the `Application.option_manager`.  The next
step will be to use the `Application.prelim_arg_parser` for parsing and
handling preliminary options and arguments.

Note that we prevent the preliminary parser from handling `-h/--help`
and defer to that to the primary parser.
2019-10-25 17:07:43 -04:00
Eric N. Vander Weele
2a5c2bb696 options: Split-out registration of preliminary options
This is in preparation for having separate `ArgumentParser`s for
preliminary and the remaining options.
2019-10-25 17:07:43 -04:00
Eric N. Vander Weele
584402fa1c config: Remove args parameter from ConfigFileFinder.__init__
Now that `args` parameters is not being used, it is safe to remove from
the constructor signature.

Further work is required to evaluate and clean-up tearing out the
threading-through of `args` from various callers and tests.
2019-10-13 13:37:19 -04:00
Anthony Sottile
fdcec2803a Don't reset indent_char when we encounter E101 2019-09-24 13:54:32 -07:00
Anthony Sottile
5144196abd Do not pass noqa to plugins, have flake8 decide whether to report 2019-08-29 13:14:12 -07:00
Eric N. Vander Weele
cf4bc53c12 Hoist passing through sys.argv at the CLI layer
`flake8.main.cli.main()` is the primary entry point for the command-line
implementation of flake8 (invoked via `__main__` or `console_scripts`).
Therefore, it is reasonable for the entry point to be responsible for
obtaining command line arguments from `sys.argv` there.

Note that `sys.argv[1:]` is necessary in order to strip off the script
name.  Formerly, this was not needed in
`Application.parse_preliminary_options_and_args()`, which was using
`sys.argv[:]` because the result of the argument parsing was just for
determining additional configuration to be loaded.  Then, the *real* CLI
argument parsing was forwarding the original `None` value to
`argparse.ArgumentParser.parse_args()`, which internally was obtaining
arguments as `sys.argv[1:]`.

Additionally, the contract for various argument parsing methods to be
guaranteed a `List[str]`.
2019-08-29 16:06:02 -04:00
Anthony Sottile
b66ebd7034 move from optparse to argparse 2019-08-17 20:09:45 -07:00
Anthony Sottile
d4b0073167 Fix / improve recently merged patches + CI 2019-07-08 14:22:51 -07:00
Thomas Grainger
9ba6677c4a support extend-exclude Fixes #535 2019-07-08 20:12:47 +00:00
Anthony Sottile
fb7e9338cd mypy now passes 2019-05-19 17:31:04 -07:00
Anthony Sottile
38ab47702a Fix crash when file fails to tokenize but parses 2019-04-07 07:42:00 -07:00
Anthony Sottile
f955a98b71 Improve error message for malformed per-file-ignores 2019-01-30 19:33:54 -08:00
Anthony Sottile
b0ecf3d28f Fix flake8 --statistics 2019-01-30 14:39:24 -08:00
Anthony Sottile
137b45ac2f Fix legacy api invocation of make_notifier 2019-01-30 11:00:36 -08:00
Anthony Sottile
915184a1e9 Add integration test for flake8 --diff 2019-01-30 09:54:13 -08:00
Tom Milligan
2803d0a810
checker: allow physical checks to return multiple results, add tests 2018-12-10 17:42:53 +00:00
Anthony Sottile
ff15ba0865 Replace setuptools with entrypoints 2018-11-05 11:08:37 -08:00
Carl Meyer
423980164b Add paths option in local-plugins config file. 2017-10-24 19:58:18 -07:00
Carl Meyer
4e58068657 Add support for local (in-repo, non-setuptools) plugins.
Closes #357
2017-08-03 00:25:37 -07:00
Ian Cordasco
32f4b65b6b
Fix docstring violations 2017-05-12 20:34:15 -05:00
Ian Cordasco
5248cf3c2d
Enable users who want to track all files processed
This adds two new methods to the BaseFormatter class:

- beginning
- finished

These will indicate when Flake8 begins and finishes processing a file.

Closes #251
2016-12-20 19:08:11 -06:00
Ian Cordasco
e14d0e6352
Serialize Checkers PluginTypeManager to a dict
It seems likely that the multiprocessing module on Windows is not
capable of serializing an object with the structure that we have and
preserving the attributes we dynamically set on plugins (like the
FlakesChecker). To avoid issues like this with all plugins (although
we have only found this on Windows with the FlakesChecker), let's try
serializing the Checkers PluginTypeManager to a dictionary so that the
only object that a Queue is really trying to serialize/deserialize is
the FlakesChecker itself.

Related to #179
2016-08-03 16:48:39 -05:00
Fabian Neundorf
ad3b486909 Sort reports by line and column
Originally the reports have been sorted by column and message (without the
error code), so it didn't order after the line number.

Closes #196
2016-07-28 19:25:13 +02:00
Ian Cordasco
5f9c0bde23
Relocate integration style checker tests 2016-07-24 20:04:48 -05:00
Ian Cordasco
8bc76f79de
Configure flake8-import-order to use Google Style
This relies on two things:

1. Properly configuring flake8-import-order to use that style
2. Properly configuring flake8-import-order to know that flake8 is our
   application name.
2016-06-17 10:26:36 -05:00
Ian Cordasco
84456866a5
Fix integration tests 2016-06-14 08:03:48 -05:00
Ian Cordasco
4c0b1cd5e1
Fix tests broken by updating the default ignore list 2016-06-07 18:46:43 -05:00
Ian Cordasco
de9f56addf Fix import ordering in test files 2016-02-25 14:41:37 -06:00
Ian Cordasco
17a7826dc7 Add integration tests for aggregate_options 2016-01-24 22:14:36 -06:00