diff --git a/tools/run-mypy b/tools/run-mypy index 60d92624e6..26aa4a2fbc 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -10,7 +10,7 @@ import argparse import subprocess import six -exclude=""" +exclude = """ api/integrations/ bots/jabber_mirror_backend.py bots/zephyr_mirror_backend.py @@ -36,6 +36,9 @@ args = parser.parse_args() if args.all: exclude = [] +# find all non-excluded files in current directory +BASE_DIR = dirname(dirname(abspath(__file__))) +exclude = [os.path.join(BASE_DIR, fpath) for fpath in exclude] python_files = lister.list_files(targets=args.targets, ftypes=['py'], use_shebang=False, modified_only=args.modified, exclude=exclude) @@ -48,6 +51,7 @@ if six.PY2 and os.path.exists(MYPY_VENV_PATH): else: mypy_command = "mypy" +# run mypy if python_files: rc = subprocess.call([mypy_command, "--fast-parser", "--silent-imports", "--py2", "--check-untyped-defs"] + python_files) sys.exit(rc)