diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-05-28 07:54:07 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-05-28 11:57:18 -0500 |
| commit | 91e07ebcffc0d4ecc472bb0031113f6030f43a20 (patch) | |
| tree | 02e64b6e6c643c4709f19bf77b4663fc23ea8cca /flake8/options | |
| parent | 50d74e3cce34e3047bcb24a2cf7cd85e5a7c1163 (diff) | |
| download | flake8-91e07ebcffc0d4ecc472bb0031113f6030f43a20.tar.gz | |
Refactor off-by-default plugins and enabling them
We move the logic to add or remove a plugin from the default ignore
list to individual methods on the Plugin class (Plugin#enable,
Plugin#disable) and use that when registering and parsing options.
If the plugin is off-by-default, Plugin#register_options will use
Plugin#disable. When parsing options via Plugin#provide_options, if
the plugin has been specified in --enable-extensions then it will be
re-enabled via Plugin#enable.
Diffstat (limited to 'flake8/options')
| -rw-r--r-- | flake8/options/manager.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/flake8/options/manager.py b/flake8/options/manager.py index bf144c9..439cba2 100644 --- a/flake8/options/manager.py +++ b/flake8/options/manager.py @@ -189,6 +189,21 @@ class OptionManager(object): self.config_options_dict[option.config_name] = option LOG.debug('Registered option "%s".', option) + def remove_from_default_ignore(self, error_codes): + """Remove specified error codes from the default ignore list. + + :param list error_codes: + List of strings that are the error/warning codes to attempt to + remove from the extended default ignore list. + """ + LOG.debug('Removing %r from the default ignore list', error_codes) + for error_code in error_codes: + try: + self.extend_default_ignore.remove(error_code) + except ValueError: + LOG.debug('Attempted to remove %s from default ignore' + ' but it was not a member of the list.', error_code) + def extend_default_ignore(self, error_codes): """Extend the default ignore list with the error codes provided. |
