mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +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
|
# type: () -> int
|
||||||
failed = check_pep8(list(python_part2))
|
failed = check_pep8(list(python_part2))
|
||||||
return 1 if failed else 0
|
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__':
|
if __name__ == '__main__':
|
||||||
run()
|
run()
|
||||||
|
|||||||
@@ -114,14 +114,14 @@ class LinterConfig:
|
|||||||
|
|
||||||
self.lint_functions[name] = run_linter
|
self.lint_functions[name] = run_linter
|
||||||
|
|
||||||
def do_lint(self, only=[], skip=[], only_list=False):
|
def do_lint(self, args):
|
||||||
# type: (List[str], List[str], bool) -> None
|
# type: (argparse.Namespace) -> None
|
||||||
assert not only or not skip, "Only one of --only or --skip can be used at once."
|
assert not args.only or not args.skip, "Only one of --only or --skip can be used at once."
|
||||||
if only:
|
if args.only:
|
||||||
self.lint_functions = {linter: self.lint_functions[linter] for linter in only}
|
self.lint_functions = {linter: self.lint_functions[linter] for linter in args.only}
|
||||||
for linter in skip:
|
for linter in args.skip:
|
||||||
del self.lint_functions[linter]
|
del self.lint_functions[linter]
|
||||||
if only_list:
|
if args.list:
|
||||||
print("\n".join(self.lint_functions.keys()))
|
print("\n".join(self.lint_functions.keys()))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user