diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2012-06-16 15:00:38 +0200 |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2012-06-16 15:00:38 +0200 |
commit | 11a80a3c36ea1541f26ab9975e50eb0971c35304 (patch) | |
tree | 918f76531d0a6e2a763c6a4e35bf6288ffc5ff17 | |
parent | 295734fdb93a5f7da765b53a2eadba6292882603 (diff) | |
download | pep8-11a80a3c36ea1541f26ab9975e50eb0971c35304.tar.gz |
Explain configuration options. Issue #82.
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rwxr-xr-x | pep8.py | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index d40efe3..98af24c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,8 @@ Changelog 1.x (UNRELEASED) ---------------- +* Explain which configuration options are expected. (Issue #82) + * Fix wrong or missing cases for the E12 series. * Fix cases where E122 was missed. (Issue #81) @@ -1755,7 +1755,8 @@ def read_config(options, args, arglist, parser): if config.has_section('pep8'): option_list = dict([(o.dest, o.type or o.action) - for o in parser.option_list if o.dest]) + for o in parser.option_list if o.dest not in + (None, 'config', 'diff', 'doctest', 'testsuite')]) # First, read the defaut values options, _ = parser.parse_args([]) @@ -1764,7 +1765,9 @@ def read_config(options, args, arglist, parser): for opt in config.options('pep8'): opt_type = option_list.get(opt) if not opt_type: - print('Unknown option: %s' % opt) + print('Unknown option: \'%s\'\n not in [%s]' % + (opt, ' '.join(sorted(option_list)))) + sys.exit(1) elif opt_type in ('int', 'count'): value = config.getint('pep8', opt) elif opt_type == 'string': |