Commit graph

519 commits

Author SHA1 Message Date
Anthony Sottile
fce93b952a prevent duplicate plugin discovery on misconfigured pythons
for example, `venv`-virtualenvs on fedora have both `lib` and `lib64` on
`sys.path` despite them being the same.  this causes
`importlib.metadata.distributions` to double-discover.

```console
$ docker run --rm -t fedora:latest bash -c 'dnf install -qq -y python3 >& /dev/null && python3 -m venv venv && venv/bin/pip -qq install cfgv && venv/bin/python - <<< "from importlib.metadata import distributions; print(len([d for d in distributions() if d.name == '"'"'cfgv'"'"']))"'
2
```
2022-07-31 18:03:25 -04:00
Max R
b0cad5530e
Remove needless sort in _style_guide_for
We are always returning the last element so a 'max' operation is sufficient instead of sorting. Note the old code did not handle an empty list so this change doesn't either
2022-07-31 07:37:54 -04:00
Anthony Sottile
c7c6218e58 Release 5.0.0 2022-07-30 17:00:41 -04:00
Anthony Sottile
7838f1191c upgrade pycodestyle to 2.9.x 2022-07-30 15:38:58 -04:00
Anthony Sottile
b9e0c6eb50 upgrade pyflakes to 2.5.x 2022-07-30 13:35:02 -04:00
Albert Tugushev
d891612d78 Fix a typo 2022-07-27 22:24:01 +02:00
Anthony Sottile
14a91d995c ignore config files in the home directory 2022-07-13 15:40:40 -04:00
Anthony Sottile
367c810f0e don't consider default codes as explicitly selected unless listed 2022-06-24 17:55:41 -04:00
Anthony Sottile
f3443f4a78 forbid invalid plugin prefixes in plugin loading 2022-04-06 16:29:25 -04:00
Anthony Sottile
c5225db626 simplify decision engine
- not specified codes (cmdline / config) are now known as being implicit via
  None sentinel
- removed redundant logic for (explicit, explicit) selection
2022-03-22 18:22:20 -07:00
Anthony Sottile
befc26f78e fix memory leak caused by lru_cache of a method 2022-03-20 17:04:30 -04:00
Tomislav Maricevic
54cf6ea0b1 Clarify that --count writes to standard output 2022-02-10 10:33:19 +01:00
Anthony Sottile
62ce3e4918
Merge pull request #1552 from PyCQA/ignore-order
make --ignore order consistent
2022-02-06 11:39:46 -05:00
Anthony Sottile
f7ef1a6c8b make --ignore order consistent 2022-02-06 08:36:36 -08:00
Anthony Sottile
58ade57ca2 re-show pycodestyle in help after plugin gen 2022-02-06 08:14:26 -08:00
Anthony Sottile
4e56fc0f6a pregenerate the pycodestyle plugin to avoid call overhead 2022-01-25 13:52:54 -05:00
Anthony Sottile
0bb55d36f2 remove slow debug() log
flake8 spends ~5-6% of `flake8 -j1 src` on this line
2022-01-23 20:55:08 -05:00
Anthony Sottile
d2333c4471 include the file path in the plugin execution error 2022-01-23 20:41:32 -05:00
Anthony Sottile
9de288a22f
Merge pull request #1541 from PyCQA/unused-function
remove function made unused by off_by_default refactor
2022-01-23 19:39:25 -05:00
Anthony Sottile
f0f71fc179 remove unused parameter from make_formatter 2022-01-23 19:33:21 -05:00
Anthony Sottile
72a02b9fdc remove function made unused by off_by_default refactor 2022-01-23 19:27:18 -05:00
Anthony Sottile
f9eb0fd6ea change keyword_arguments_for so it does not modify and return 2022-01-23 19:06:06 -05:00
Anthony Sottile
9343a993f6 remove triple logged stacktrace on unknown plugin args 2022-01-23 18:32:28 -05:00
Anthony Sottile
929cf5dfd3 remove log_token and EXTRA_VERBOSE
- flake8 spent 5% of execution in `log_token`
- `EXTRA_VERBOSE` was only used by `log_token`
- `python -m tokenize` provides better debug token output
2022-01-23 18:08:58 -05:00
Anthony Sottile
23a60dd902 use the actual line contents when processing physical lines 2022-01-22 15:27:53 -05:00
Anthony Sottile
d03b9c97cc add a --require-plugins option 2022-01-22 14:08:32 -05:00
Anthony Sottile
9d23faad6d always use UTF-8 encoding when reading configuration 2022-01-20 14:03:18 -05:00
Anthony Sottile
6663a2fb9f
Merge pull request #1528 from PyCQA/plugin_paths_plugin_options
combine local_plugin_paths and parse_plugin_options
2022-01-18 21:02:34 -05:00
Anthony Sottile
c194d6cc30 combine local_plugin_paths and parse_plugin_options 2022-01-18 20:57:09 -05:00
Anthony Sottile
9b9072e13d slightly improve unknown parameter error 2022-01-18 20:25:58 -05:00
Anthony Sottile
c2610debe6 fix docs build 2022-01-17 17:20:44 -05:00
Anthony Sottile
1b58293ad3 refactor plugin loading options to prepare for --require-plugins 2022-01-10 20:06:26 -05:00
Anthony Sottile
5ca854a615 simplify a bit of code in style_guide.py 2022-01-05 18:56:53 -08:00
Anthony Sottile
ec57d5e67c use tokenize.TokenInfo instead of _Token alias 2022-01-05 15:37:25 -05:00
Anthony Sottile
741ff11bfb use type hints instead of :type and :rtype 2022-01-05 14:09:39 -05:00
Anthony Sottile
fa4c31fb97 break type checking cycles 2022-01-05 13:40:16 -05:00
Anthony Sottile
3c885219b5 use typesafe NamedTuple 2022-01-05 13:02:38 -05:00
Anthony Sottile
78b2db4072 type the rest of the legacy api 2022-01-05 12:35:38 -05:00
Anthony Sottile
1c3fef6cda invert order of legacy to make it easier to type 2022-01-05 12:08:16 -05:00
Anthony Sottile
3b9b332560 type api.legacy.Report 2022-01-05 12:03:58 -05:00
Anthony Sottile
4cb1dc8c44 perform path normalization on '.' 2022-01-05 11:44:31 -05:00
Anthony Sottile
b62edd334a fix extended_default_select from plugin loading 2022-01-01 19:26:43 -05:00
Anthony Sottile
a8333e2bf2 move managing of off_by_default / enable_extensions to plugin loading 2022-01-01 18:33:07 -05:00
Anthony Sottile
50d69150c1 rework plugin loading 2021-12-31 15:09:54 -08:00
Ruairidh MacLeod
d948169292 add check for a missing specified config file 2021-12-24 23:40:31 +00:00
Anthony Sottile
a7be5e798b fix AttributeError when catatstrophic failure is triggered 2021-12-24 16:38:17 -05:00
Anthony Sottile
f98d52a398 have OptionManager take plugin versions directly 2021-12-08 15:49:17 -05:00
Anthony Sottile
1e4743d490 use plugin_name= instead of dicts in exceptions 2021-12-07 15:36:20 -08:00
Anthony Sottile
3fa044ca4b return an argparser instead of side-effects 2021-12-07 15:28:58 -08:00
Anthony Sottile
52fb518104 eliminate --bug-report double-parse quirk with store_true 2021-12-07 13:49:57 -08:00