summaryrefslogtreecommitdiff
path: root/src/flake8/plugins/manager.py
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-06-28 07:42:51 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-06-28 07:42:51 -0500
commitec2e601cbf9a56c9bee2ee3cc22999c795c1c824 (patch)
tree5f9535dcd61d6c9925ccbb90acf9347733fab549 /src/flake8/plugins/manager.py
parent31c32e3327c50ff713445280c061bf2c255feb19 (diff)
downloadflake8-ec2e601cbf9a56c9bee2ee3cc22999c795c1c824.tar.gz
Enable plugins automatically during registration
Previously the --select was only ever populated to E,F,W,C and so plugins would not be reported when not off-by-default. This adds a tiny shim so that we enable plugins that are not off-by-default and :x :x
Diffstat (limited to 'src/flake8/plugins/manager.py')
-rw-r--r--src/flake8/plugins/manager.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/flake8/plugins/manager.py b/src/flake8/plugins/manager.py
index d08d542..697b35f 100644
--- a/src/flake8/plugins/manager.py
+++ b/src/flake8/plugins/manager.py
@@ -161,6 +161,7 @@ class Plugin(object):
def enable(self, optmanager):
"""Remove plugin name from the default ignore list."""
optmanager.remove_from_default_ignore([self.name])
+ optmanager.extend_default_select([self.name])
def disable(self, optmanager):
"""Add the plugin name to the default ignore list."""
@@ -418,6 +419,16 @@ class Checkers(PluginTypeManager):
if argument_name == plugin.parameters[0]:
yield plugin
+ def register_options(self, optmanager):
+ """Register all of the checkers' options to the OptionManager."""
+ super(Checkers, self).register_options(optmanager)
+
+ def conditionally_enable(plugin):
+ if plugin.group() is None and not plugin.off_by_default:
+ plugin.enable(optmanager)
+
+ list(self.manager.map(conditionally_enable))
+
@property
def ast_plugins(self):
"""List of plugins that expect the AST tree."""