diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-05-10 20:12:38 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-05-10 20:14:54 -0500 |
| commit | d929dd57cb80a31f151535d32f7593d95c4e80ee (patch) | |
| tree | f4c4a763c27ff8df29186dbd7ef3c9c7171f11a1 | |
| parent | ccadc09a0e2489be41e024a2bfa1a100072af041 (diff) | |
| download | flake8-d929dd57cb80a31f151535d32f7593d95c4e80ee.tar.gz | |
Add a property for off-by-default plugins
If a plugin is off-by-default use its entry-point name (as we currently
do in flake8 2.x) to add it to the default ignore list.
| -rw-r--r-- | flake8/plugins/manager.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/flake8/plugins/manager.py b/flake8/plugins/manager.py index 56ee813..fe51391 100644 --- a/flake8/plugins/manager.py +++ b/flake8/plugins/manager.py @@ -108,6 +108,11 @@ class Plugin(object): return self._plugin_name + @property + def off_by_default(self): + """Return whether the plugin is ignored by default.""" + return getattr(self.plugin, 'off_by_default', False) + def execute(self, *args, **kwargs): r"""Call the plugin with \*args and \*\*kwargs.""" return self.plugin(*args, **kwargs) # pylint: disable=not-callable @@ -181,6 +186,9 @@ class Plugin(object): ) add_options(optmanager) + if self.off_by_default: + optmanager.extend_default_ignore([self.name]) + class PluginManager(object): # pylint: disable=too-few-public-methods """Find and manage plugins consistently.""" |
