diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-02-23 23:25:12 -0600 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-02-23 23:25:12 -0600 |
| commit | cd18b9f175a3a73b03f58d4db7fd789c48c671bb (patch) | |
| tree | 23c26981410d6a2ba6fbb9269ffc61b90da2105f | |
| parent | 24d2689a0519cb453eb67d6a0ef37f60efc8f0fd (diff) | |
| download | flake8-cd18b9f175a3a73b03f58d4db7fd789c48c671bb.tar.gz | |
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.
| -rw-r--r-- | flake8/plugins/manager.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/flake8/plugins/manager.py b/flake8/plugins/manager.py index 21639f9..05e5e2b 100644 --- a/flake8/plugins/manager.py +++ b/flake8/plugins/manager.py @@ -304,10 +304,28 @@ 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.""" plugins = getattr(self, '_physical_line_plugins', []) |
