Commit graph

282 commits

Author SHA1 Message Date
Eric N. Vander Weele
f01011a403 Normalize option values additionally by type
Now that the contract has narrowed for `utils.normalize_paths()`
and `utils.parse_comma_separated_list()`, `Option.normalize()` must
handle when the option value is either a singular value or a sequence
(i.e., `list`) of values.

The paths where `Option.normalize()` is called are:

1. options/config.py: `MergedConfigParser.parse_*_config()`
    There are 3 paths wehre eventually `_normalize_value()` is called.
2. options/manager.py: `OptionManager.parse_args()`

For (1), values are coming from the `configparser` module.  For (2),
values are coming from `optparse.OptionParser`.

Rudimentary investigation seems to implicate that
`optparse.OptionParser.parse_args()` always returns values in a `list`
because it accumulates values.  However, for `configparser`, the values
are a string due to the key-value nature of the INI format.

Given that `Option.normalize()` is the convergence point where
normalization of an option occurs, it is acceptable for the method to
also handle the parsing comma-separated values and path normalization by
the option value's type.
2019-07-28 10:43:06 -04:00
Eric N. Vander Weele
1ba56b9056 utils: Change normalize_paths() contract
The `normalize_paths()` utility was doing too much — parsing
unstructured configuration path data and dispatching the scrubbed paths
to be normalized.

Towards moving the parsing of unstructured configuration path data
closer towards were configuration occurs, have the utility accept only
structured input for normalizing paths.
2019-07-28 10:43:06 -04:00
Eric N. Vander Weele
a0cd55fd6d utils: Assert desired contract for normalize_paths()
This is a separate commit so it can be dropped during a rebase or revert
independently.
2019-07-28 10:43:06 -04:00
Eric N. Vander Weele
9283f2f03f utils: Change parse_comma_separated_list() contract
This is the initial incision point to only accept `str` (or `None`) for
parsing out comma/whitespace/regexp separated values.
2019-07-28 10:43:02 -04:00
Eric N. Vander Weele
9fbaf2d2ea utils: Assert desired contract for parse_comma_separated_list()
This is a separate commit so it can be dropped during a rebase or
reverted independently.
2019-07-28 10:39:27 -04:00
Anthony Sottile
862b17d229 Merge branch 'extra-config-normalization' into 'master'
Push down extra config file path normalization into main config handling

See merge request pycqa/flake8!333
2019-07-23 04:29:28 +00:00
Eric N. Vander Weele
95f26d7fe9 Push down extra config file path normalization into main config handling
Move the path normalization for extra configuration file paths down into
the main `config` module where other path normalization occurs.

This also guarantees that the call to `utils.normalize_paths()` is given
a sequence, instead of a potential `None` value.
2019-07-22 21:29:24 -04: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
0d7247082e Merge branch 'master' into 'master'
Remove filter by filename in utils.filenames_from

Closes #382

See merge request pycqa/flake8!311
2019-07-08 20:11:25 +00:00
Anthony Sottile
aa792d2930 Release 3.7.8 2019-07-08 11:21:04 -07:00
Eric N. Vander Weele
24e8b8163c pyflakes: Change to normalize_path() for filename normalization
It's unnecessary to call the `normalize_paths()` function because it is
intended for dealing with multiple paths to normalize.  Given that
`normalize_paths()` utilizes `normalize_path()`, just call
`normalize_path()` directly.
2019-07-08 09:58:24 -07:00
Anthony Sottile
7506847c9a fix CI build 2019-07-08 09:07:37 -07:00
Markus Piotrowski
0ac337608b This PR addresses issue #549 (noqa does only work as intended with single letter error codes). A single change in the regex NOQA_INLINE_REGEXP in defaults.py will allow to catch error codes which consist of more than one letter.
This will close #549.
2019-06-16 15:55:37 +00:00
Anthony Sottile
2f8bc64b1e Merge branch 'show_traceback' into 'master'
Show traceback on plugin exception

See merge request pycqa/flake8!317
2019-06-14 18:03:39 +00:00
Ivan Pozdeev
6813f159d7 Show traceback on plugin exception 2019-05-20 22:44:03 +03:00
Anthony Sottile
fb7e9338cd mypy now passes 2019-05-19 17:31:04 -07:00
Anthony Sottile
dcd37ec3d4 whitelist a bandit false positive and improve type annotation 2019-05-19 09:39:14 -07:00
Anthony Sottile
38ab47702a Fix crash when file fails to tokenize but parses 2019-04-07 07:42:00 -07:00
Yevhen Amelin
6fb49b2e80 Remove filter by filename in utils.filenames_from 2019-03-19 09:59:12 +02:00
Charles Frye
16ca17388a Fixes handling of empty lists by Application
`Application.parse_preliminary_options_and_args` was previously, against
expectations, treating empty lists passed as the `argv` argument the
same way it treated `None`s.

This has been addressed and the correct behavior tested for in a unit
test of the `Application` class.

See issue #518 for details.
2019-03-07 20:27:59 -08:00
Anthony Sottile
88caf5ac48 Release 3.7.7 2019-02-25 08:36:58 -08:00
Anthony Sottile
e8de066f94 Ensure exceptions are pickleable 2019-02-19 08:38:37 -08:00
Anthony Sottile
9b770f590e Release 3.7.6 2019-02-18 11:58:12 -08:00
Ian Stapleton Cordasco
59c2f093de Merge branch 'mypy_improvements' into 'master'
Improve a few mypy type annotations

See merge request pycqa/flake8!307
2019-02-17 15:23:30 +00:00
Ian Stapleton Cordasco
a21d74152b Merge branch 'perf_only_one_proc' into 'master'
Speed up flake8 when only 1 filename is passed

See merge request pycqa/flake8!305
2019-02-17 15:23:12 +00:00
Anthony Sottile
c71fadb18c Improve a few mypy type annotations 2019-02-17 00:16:19 -08:00
Anthony Sottile
e8f43e1243 Speed up flake8 when only 1 filename is passed
~40% improvement over status quo (perf measurements are best-of-5)

### before

```console
$ time flake8 /dev/null

real    0m0.337s
user    0m0.212s
sys     0m0.028s
```

### after

```console
$ time flake8 /dev/null

real    0m0.197s
user    0m0.182s
sys     0m0.012s
```
2019-02-17 00:15:00 -08:00
Anthony Sottile
a252a0b138 Remove pyflakes monkeypatching 2019-02-16 18:05:00 -08:00
Илья Лебедев
8e99b531cf FIX 507: allow multiple letters in codes 2019-02-11 17:00:34 +03:00
Anthony Sottile
e7b8493b5d Release 3.7.5 2019-02-04 08:37:16 -08:00
Anthony Sottile
8df38c92b9 Fix reporting of UndefinedLocal pyflakes error 2019-01-31 21:55:10 -08:00
Anthony Sottile
3d54751236 Remove noqa comments now that 3.7 has been released 2019-01-31 20:12:23 -08:00
Anthony Sottile
afc57d471d Release 3.7.4 2019-01-31 19:53:02 -08:00
Anthony Sottile
c85b282b05 Fix performance regression with per-file-ignores
With a large number of errors, filenames, and per-file-ignores the style guide
selection would take a significant portion of execution time
(python3 70% / python2 99.9%).

Caching the styleguide lookup by filename eliminates this bottleneck.
2019-01-31 09:23:02 -08:00
Anthony Sottile
ee7081c8ce Release 3.7.3 2019-01-30 19:55:58 -08:00
Anthony Sottile
f955a98b71 Improve error message for malformed per-file-ignores 2019-01-30 19:33:54 -08:00
Anthony Sottile
f7a7e58119 Gracefully ignore flake8-per-file-ignores if installed 2019-01-30 19:01:49 -08:00
Anthony Sottile
cbffa49a0b Merge branch 'fix_statistics' into 'master'
Fix flake8 --statistics

Closes #499

See merge request pycqa/flake8!295
2019-01-30 23:05:48 +00:00
Anthony Sottile
b0ecf3d28f Fix flake8 --statistics 2019-01-30 14:39:24 -08:00
Anthony Sottile
eb886a268f Make uses of typing compatible with python 3.5.1 / 3.5.0 2019-01-30 14:03:55 -08:00
Anthony Sottile
3d1a4265a7 Release 3.7.2 2019-01-30 12:51:49 -08:00
Anthony Sottile
137b45ac2f Fix legacy api invocation of make_notifier 2019-01-30 11:00:36 -08:00
Anthony Sottile
941b120819 Merge branch 'is/490' into 'master'
Fix bug flake8 --diff

Closes #490

See merge request pycqa/flake8!292
2019-01-30 18:09:54 +00:00
Tomer Keren
c68e7a8d3e Fix plugin exception reporting keyerror typo 2019-01-30 08:55:57 -08:00
Guillaume Lemaitre
763f68b623 BUG: fix flake8 --diff 2019-01-30 17:45:18 +01:00
Anthony Sottile
f70ae10c2b Release 3.7.1 2019-01-30 00:07:43 -08:00
Anthony Sottile
0c470a65d7 Allow capitalized filenames in per-file-ignores 2019-01-29 23:17:45 -08:00
Anthony Sottile
22f16e4081 Release v3.7.0 2019-01-29 20:28:38 -08:00
Anthony Sottile
50e7cc71b9 Latest pycodestyle 2019-01-29 08:58:10 -08:00