mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 03:41:58 +00:00
lint: Pass args instead of passing individual attributes to do_lint.
Pass the args to linter_config.do_lint.
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user