Implement --only and --exclude flags
This commit is contained in:
parent
1e26d46d17
commit
b485697742
|
@ -449,6 +449,16 @@ def run_linters(options, config, extras=[]):
|
|||
|
||||
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)
|
||||
|
||||
cant_lint_filter = MatchFilter(build_config_subset(
|
||||
|
|
Loading…
Reference in New Issue