mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-29 10:36:53 +00:00
fix extended_default_select from plugin loading
This commit is contained in:
parent
73155616d1
commit
b62edd334a
4 changed files with 14 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
)
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ def test_local_plugin_can_add_option(local_config):
|
|||
|
||||
args = aggregator.aggregate_options(option_manager, cfg, cfg_dir, argv)
|
||||
|
||||
assert args.extended_default_select == {"XE", "F", "E", "C90"}
|
||||
assert args.anopt == "foo"
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ def test_flake8_plugins(flake8_dist, mock_distribution):
|
|||
"pycodestyle",
|
||||
"9000.2.0",
|
||||
importlib_metadata.EntryPoint(
|
||||
"pycodestyle.bare_except",
|
||||
"E",
|
||||
"pycodestyle:bare_except",
|
||||
"flake8.extension",
|
||||
),
|
||||
|
|
@ -188,7 +188,7 @@ def test_flake8_plugins(flake8_dist, mock_distribution):
|
|||
"pycodestyle",
|
||||
"9000.2.0",
|
||||
importlib_metadata.EntryPoint(
|
||||
"pycodestyle.blank_lines",
|
||||
"E",
|
||||
"pycodestyle:blank_lines",
|
||||
"flake8.extension",
|
||||
),
|
||||
|
|
@ -274,7 +274,7 @@ unrelated = unrelated:main
|
|||
"pycodestyle",
|
||||
"9000.2.0",
|
||||
importlib_metadata.EntryPoint(
|
||||
"pycodestyle.bare_except",
|
||||
"E",
|
||||
"pycodestyle:bare_except",
|
||||
"flake8.extension",
|
||||
),
|
||||
|
|
@ -283,7 +283,7 @@ unrelated = unrelated:main
|
|||
"pycodestyle",
|
||||
"9000.2.0",
|
||||
importlib_metadata.EntryPoint(
|
||||
"pycodestyle.blank_lines",
|
||||
"E",
|
||||
"pycodestyle:blank_lines",
|
||||
"flake8.extension",
|
||||
),
|
||||
|
|
@ -459,7 +459,7 @@ def test_find_plugins(
|
|||
"pycodestyle",
|
||||
"9000.2.0",
|
||||
importlib_metadata.EntryPoint(
|
||||
"pycodestyle.bare_except",
|
||||
"E",
|
||||
"pycodestyle:bare_except",
|
||||
"flake8.extension",
|
||||
),
|
||||
|
|
@ -468,7 +468,7 @@ def test_find_plugins(
|
|||
"pycodestyle",
|
||||
"9000.2.0",
|
||||
importlib_metadata.EntryPoint(
|
||||
"pycodestyle.blank_lines",
|
||||
"E",
|
||||
"pycodestyle:blank_lines",
|
||||
"flake8.extension",
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue