diff options
-rw-r--r-- | CHANGES.txt | 2 | ||||
-rw-r--r-- | README.rst | 1 | ||||
-rwxr-xr-x | pep8.py | 14 |
3 files changed, 17 insertions, 0 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index dfd4163..3ca6a6f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,6 +5,8 @@ Changelog 0.5 (unreleased) ---------------- +* Add --select option which is mirror of --ignore + * New check W603 warns about the deprecated operator ``<>`` * Performance improvement, due to rewriting of E225 @@ -82,6 +82,7 @@ Quick help is available on the command line:: separated patterns (default: .svn,CVS,.bzr,.hg,.git) --filename=patterns when parsing directories, only check filenames matching these comma separated patterns (default: *.py) + --select=errors select errors and warnings (e.g. E,W6) --ignore=errors skip errors and warnings (e.g. E4,W) --repeat show all occurrences of the same error --show-source show source code for each error @@ -981,7 +981,11 @@ def filename_match(filename): def ignore_code(code): """ Check if options.ignore contains a prefix of the error code. + If options.select contains a prefix of the error code, do not ignore it. """ + for select in options.select: + if code.startswith(select): + return False for ignore in options.ignore: if code.startswith(ignore): return True @@ -1114,6 +1118,8 @@ def process_options(arglist=None): help="when parsing directories, only check filenames " "matching these comma separated patterns (default: " "*.py)") + parser.add_option('--select', metavar='errors', default='', + help="select errors and warnings (e.g. E,W6)") parser.add_option('--ignore', metavar='errors', default='', help="skip errors and warnings (e.g. E4,W)") parser.add_option('--repeat', action='store_true', @@ -1143,9 +1149,17 @@ def process_options(arglist=None): options.exclude[index] = options.exclude[index].rstrip('/') if options.filename: options.filename = options.filename.split(',') + if options.select: + options.select = options.select.split(',') + else: + options.select = [] if options.ignore: options.ignore = options.ignore.split(',') + elif options.select: + # Ignore all checks which are not explicitly selected + options.ignore = [''] else: + # The default choice: all checks are required options.ignore = [] options.physical_checks = find_checks('physical_line') options.logical_checks = find_checks('logical_line') |