From 7d40f525f0fde4c85b1ab76672a2f04b89c5b3ec Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Thu, 11 Feb 2016 09:41:14 -0600 Subject: [PATCH] Definitely fix bug reading options from config files Previously we were not reading output_file or enable_extensions from user provided configuration files. The configuration option name provided to config_options needs to be hyphenated in order for pep8 to recognize and parse out the option correctly. Also, the destination name needs to match the configuration option name that pep8 looks for otherwise it will raise an unhandled KeyError exception. --- flake8/engine.py | 4 ++-- flake8/tests/test_engine.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flake8/engine.py b/flake8/engine.py index 5ee91a5..8d27000 100644 --- a/flake8/engine.py +++ b/flake8/engine.py @@ -103,11 +103,11 @@ def get_parser(): type='string', nargs=1, action='callback', callback=callbacks.redirect_stdout) parser.add_option('--enable-extensions', default='', - dest='enabled_extensions', + dest='enable_extensions', help='Enable plugins and extensions that are disabled ' 'by default', type='string') - parser.config_options.extend(['output_file', 'enable_extensions']) + parser.config_options.extend(['output-file', 'enable-extensions']) parser.ignored_extensions = ignored return parser, options_hooks diff --git a/flake8/tests/test_engine.py b/flake8/tests/test_engine.py index 2afabbb..82ba0dd 100644 --- a/flake8/tests/test_engine.py +++ b/flake8/tests/test_engine.py @@ -62,7 +62,7 @@ class TestEngine(unittest.TestCase): parser.ignored_extensions = ['I123', 'I345', 'I678', 'I910'] - options.enabled_extensions = 'I345,\nI678,I910' + options.enable_extensions = 'I345,\nI678,I910' options.ignore = ('E121', 'E123') engine._disable_extensions(parser, options)