diff --git a/mypy.ini b/mypy.ini index 1c36f6ba6d..dc277f2583 100644 --- a/mypy.ini +++ b/mypy.ini @@ -62,7 +62,7 @@ ignore_missing_imports = True [mypy-linter_lib.printer] ignore_missing_imports = True -[mypy-zulint,zulint.lister,zulint.lister.*] +[mypy-zulint,zulint.*,zulint.lister.*] ignore_missing_imports = True diff --git a/tools/lint b/tools/lint index 8e7c4cf08b..375b2860cc 100755 --- a/tools/lint +++ b/tools/lint @@ -14,6 +14,7 @@ from lib import sanity_check sanity_check.check_venv(__file__) from zulint import lister +from zulint.command import add_default_linter_arguments from typing import cast, Callable, Dict, Iterator, List @@ -50,15 +51,6 @@ def run(): parser.add_argument('--no-gitlint', action='store_true', help='Disable gitlint') - parser.add_argument('--modified', '-m', - action='store_true', - help='Only check modified files') - parser.add_argument('--verbose', '-v', - action='store_true', - help='Print verbose timing output') - parser.add_argument('targets', - nargs='*', - help='Specify directories to check') limited_tests_group = parser.add_mutually_exclusive_group() limited_tests_group.add_argument('--frontend', action='store_true', @@ -66,6 +58,7 @@ def run(): limited_tests_group.add_argument('--backend', action='store_true', help='Only check files relevant to backend') + add_default_linter_arguments(parser) args = parser.parse_args() tools_dir = os.path.dirname(os.path.abspath(__file__)) diff --git a/tools/zulint/command.py b/tools/zulint/command.py new file mode 100644 index 0000000000..c54f1f420b --- /dev/null +++ b/tools/zulint/command.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from __future__ import print_function +from __future__ import absolute_import + +import argparse + +def add_default_linter_arguments(parser): + # type: (argparse.ArgumentParser) -> None + parser.add_argument('--modified', '-m', + action='store_true', + help='Only check modified files') + parser.add_argument('--verbose', '-v', + action='store_true', + help='Print verbose timing output') + parser.add_argument('targets', + nargs='*', + help='Specify directories to check')