summaryrefslogtreecommitdiff
path: root/flake8/plugins/manager.py
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-02-26 08:21:09 -0600
committerIan Cordasco <graffatcolmingov@gmail.com>2016-02-26 08:21:09 -0600
commit6a15bd00b52d44830cda9eb73411423210344fc3 (patch)
treeed667f375f438bd384e1b967a05fb47e8b00d79a /flake8/plugins/manager.py
parent62a78f4a97ef82b3a28d1478635fc4f501762657 (diff)
downloadflake8-6a15bd00b52d44830cda9eb73411423210344fc3.tar.gz
Store plugin parameters on the plugin itself
This allows us to access these from the checker module as well.
Diffstat (limited to 'flake8/plugins/manager.py')
-rw-r--r--flake8/plugins/manager.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/flake8/plugins/manager.py b/flake8/plugins/manager.py
index aba5f16..c453dbe 100644
--- a/flake8/plugins/manager.py
+++ b/flake8/plugins/manager.py
@@ -35,6 +35,7 @@ class Plugin(object):
self.name = name
self.entry_point = entry_point
self._plugin = None
+ self._parameters = None
def __repr__(self):
"""Provide an easy to read description of the current plugin."""
@@ -43,6 +44,13 @@ class Plugin(object):
)
@property
+ def parameters(self):
+ """List of arguments that need to be passed to the plugin."""
+ if self._parameters is None:
+ self._parameters = utils.parameters_for(self)
+ return self._parameters
+
+ @property
def plugin(self):
"""The loaded (and cached) plugin associated with the entry-point.
@@ -303,8 +311,7 @@ class Checkers(PluginTypeManager):
Find all checker plugins that are expecting a specific argument.
"""
for plugin in self.plugins.values():
- parameters = utils.parameters_for(plugin)
- if argument_name == parameters[0]:
+ if argument_name == plugin.parameters[0]:
yield plugin
@property