mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 02:46:52 +00:00
Constrain our search for plugin type
Flake8 has previously only ever relied on the first member of the parameters list to determine what kind of check it is using. As such, we constrain ourselves to just that parameter when checking and add properties for ast and logical line checks.
This commit is contained in:
parent
24d2689a05
commit
cd18b9f175
1 changed files with 19 additions and 1 deletions
|
|
@ -304,9 +304,27 @@ class Checkers(PluginTypeManager):
|
|||
"""
|
||||
for plugin in self.plugins.values():
|
||||
parameters = utils.parameters_for(plugin)
|
||||
if argument_name in parameters:
|
||||
if argument_name == parameters[0]:
|
||||
yield plugin
|
||||
|
||||
@property
|
||||
def ast_plugins(self):
|
||||
"""List of plugins that expect the AST tree."""
|
||||
plugins = getattr(self, '_ast_plugins', [])
|
||||
if not plugins:
|
||||
plugins = list(self.checks_expecting('tree'))
|
||||
self._ast_plugins = plugins
|
||||
return plugins
|
||||
|
||||
@property
|
||||
def logical_line_plugins(self):
|
||||
"""List of plugins that expect the logical lines."""
|
||||
plugins = getattr(self, '_logical_line_plugins', [])
|
||||
if not plugins:
|
||||
plugins = list(self.checks_expecting('logical_line'))
|
||||
self._logical_line_plugins = plugins
|
||||
return plugins
|
||||
|
||||
@property
|
||||
def physical_line_plugins(self):
|
||||
"""List of plugins that expect the physical lines."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue