Do not exit when an option in setup.cfg / tox.ini is not recognized
authorFlorent Xicluna <florent.xicluna@gmail.com>
Mon, 5 May 2014 18:09:19 +0000 (20:09 +0200)
committerFlorent Xicluna <florent.xicluna@gmail.com>
Mon, 5 May 2014 18:09:19 +0000 (20:09 +0200)
CHANGES.txt
pep8.py

index e12f89d5c622443773e5d3443d91ad739409b809..d8571b55b8aaed8042c5541575336723f414b858 100644 (file)
@@ -9,6 +9,9 @@ Bug fixes:
 
 * Skip the traceback on "Broken pipe" signal. (Issue #275)
 
+* Do not exit when an option in ``setup.cfg`` or ``tox.ini``
+  is not recognized.
+
 
 1.5.6 (2014-04-14)
 ------------------
diff --git a/pep8.py b/pep8.py
index 0671ac7f513f6387d7b21277068df6274cf57e4c..bc9113743f38c6b99850f81baa70ed25be2356db 100755 (executable)
--- a/pep8.py
+++ b/pep8.py
@@ -1837,12 +1837,11 @@ def read_config(options, args, arglist, parser):
 
         # Second, parse the configuration
         for opt in config.options(pep8_section):
+            if opt.replace('_', '-') not in parser.config_options:
+                print("  unknown option '%s' ignored" % opt)
+                continue
             if options.verbose > 1:
                 print("  %s = %s" % (opt, config.get(pep8_section, opt)))
-            if opt.replace('_', '-') not in parser.config_options:
-                print("Unknown option: '%s'\n  not in [%s]" %
-                      (opt, ' '.join(parser.config_options)))
-                sys.exit(1)
             normalized_opt = opt.replace('-', '_')
             opt_type = option_list[normalized_opt]
             if opt_type in ('int', 'count'):