diff --git a/tools/lint b/tools/lint index f2a6814ee8..20d71e1996 100755 --- a/tools/lint +++ b/tools/lint @@ -125,7 +125,7 @@ def run(): # type: () -> int failed = check_pep8(list(python_part2)) return 1 if failed else 0 - linter_config.do_lint(skip=args.skip, only=args.only, only_list=args.list) + linter_config.do_lint(args) if __name__ == '__main__': run() diff --git a/tools/zulint/command.py b/tools/zulint/command.py index bbcbe044f7..32c85ca20e 100644 --- a/tools/zulint/command.py +++ b/tools/zulint/command.py @@ -114,14 +114,14 @@ class LinterConfig: self.lint_functions[name] = run_linter - def do_lint(self, only=[], skip=[], only_list=False): - # type: (List[str], List[str], bool) -> None - assert not only or not skip, "Only one of --only or --skip can be used at once." - if only: - self.lint_functions = {linter: self.lint_functions[linter] for linter in only} - for linter in skip: + def do_lint(self, args): + # type: (argparse.Namespace) -> None + assert not args.only or not args.skip, "Only one of --only or --skip can be used at once." + if args.only: + self.lint_functions = {linter: self.lint_functions[linter] for linter in args.only} + for linter in args.skip: del self.lint_functions[linter] - if only_list: + if args.list: print("\n".join(self.lint_functions.keys())) sys.exit()