Merge pull request #3 from tino/add-only-and-exclude

Implement --only and --exclude flags
This commit is contained in:
Elf M. Sternberg 2017-08-01 13:23:14 -07:00 committed by GitHub
commit ef2a5c579b
1 changed files with 19 additions and 9 deletions

View File

@ -449,6 +449,16 @@ def run_linters(options, config, extras=[]):
unlintable_filenames = set(all_filenames) - lintable_filenames unlintable_filenames = set(all_filenames) - lintable_filenames
# Filter the linter config down to the selected ones.
if 'only' in options:
config = [linter for linter in config
if linter.name in options['only']]
elif 'exclude' in options:
config = [linter for linter in config
if linter.name not in options['exclude']]
if not len(config):
raise RuntimeError('No linters left to run! Be less strict with --only and --exclude.')
working_linter_names, broken_linter_names = get_linter_status(config) working_linter_names, broken_linter_names = get_linter_status(config)
cant_lint_filter = MatchFilter(build_config_subset( cant_lint_filter = MatchFilter(build_config_subset(