support extend-exclude Fixes #535

This commit is contained in:
Thomas Grainger 2019-07-08 20:12:47 +00:00 committed by Anthony Sottile
parent 0d7247082e
commit 9ba6677c4a
6 changed files with 70 additions and 9 deletions

View file

@ -1,6 +1,7 @@
"""Checker Manager and Checker classes."""
import collections
import errno
import itertools
import logging
import signal
import tokenize
@ -79,6 +80,9 @@ class Manager(object):
"physical lines": 0,
"tokens": 0,
}
self.exclude = tuple(
itertools.chain(self.options.exclude, self.options.extend_exclude),
)
def _process_statistics(self):
for checker in self.checkers:
@ -187,7 +191,7 @@ class Manager(object):
return utils.matches_filename(
path,
patterns=self.options.exclude,
patterns=self.exclude,
log_message='"%(path)s" has %(whether)sbeen excluded',
logger=LOG,
)

View file

@ -14,6 +14,7 @@ def register_default_options(option_manager):
- ``--count``
- ``--diff``
- ``--exclude``
- ``--extend-exclude``
- ``--filename``
- ``--format``
- ``--hang-closing``
@ -85,6 +86,16 @@ def register_default_options(option_manager):
" (Default: %default)",
)
add_option(
"--extend-exclude",
metavar="patterns",
default="",
parse_from_config=True,
comma_separated_list=True,
help="Comma-separated list of files or directories to add to the list"
" of excluded ones."
)
add_option(
"--filename",
metavar="patterns",