fix extended_default_select from plugin loading

This commit is contained in:
Anthony Sottile 2022-01-01 19:26:43 -05:00
parent 73155616d1
commit b62edd334a
4 changed files with 14 additions and 7 deletions

View file

@ -376,7 +376,8 @@ class OptionManager:
_set_group(loaded.plugin.package)
add_options(self)
self.extend_default_select(loaded.entry_name)
if loaded.plugin.entry_point.group == "flake8.extension":
self.extend_default_select([loaded.entry_name])
# isn't strictly necessary, but seems cleaner
self._current_group = None

View file

@ -102,6 +102,11 @@ def _flake8_plugins(
if ep.name == "F":
yield Plugin(pyflakes_meta["name"], pyflakes_meta["version"], ep)
elif ep.name.startswith("pycodestyle"):
# pycodestyle provides both `E` and `W` -- but our default select
# handles those
# ideally pycodestyle's plugin entrypoints would exactly represent
# the codes they produce...
ep = importlib_metadata.EntryPoint("E", ep.value, ep.group)
yield Plugin(
pycodestyle_meta["name"], pycodestyle_meta["version"], ep
)