Parse hyphenated config names also

Previously Flake8 parsed both

    max-line-length = 110

And

    max_line_length = 110

From the config file without issue. When we updated our logic, I forgot
to test for that and we lost that behaviour temporarily.

Closes #152
This commit is contained in:
Ian Cordasco 2016-06-28 05:47:14 -05:00
parent 95c373cf11
commit 31c32e3327
No known key found for this signature in database
GPG key ID: 656D3395E4A9791A
4 changed files with 37 additions and 2 deletions

View file

@ -192,7 +192,7 @@ class MergedConfigParser(object):
LOG.debug('Option "%s" returned value: %r', option_name, value)
final_value = self._normalize_value(option, value)
config_dict[option_name] = final_value
config_dict[option.config_name] = final_value
return config_dict

View file

@ -186,7 +186,9 @@ class OptionManager(object):
self.parser.add_option(option.to_optparse())
self.options.append(option)
if option.parse_from_config:
self.config_options_dict[option.config_name] = option
name = option.config_name
self.config_options_dict[name] = option
self.config_options_dict[name.replace('_', '-')] = option
LOG.debug('Registered option "%s".', option)
def remove_from_default_ignore(self, error_codes):