mirror of https://github.com/zulip/zulip.git
run-mypy: Check scripts by default.
Previously, we checked scripts in a separate run to work around mypy not supporting multiple scripts with the same name. Since we have fixed that issue, we can restore the original behavior. We leave the --scripts-only option available, though I'm not sure it's particularly useful and we'll probably eventually remove it.
This commit is contained in:
parent
4dbdf7e373
commit
9e503f2dcf
|
@ -99,7 +99,7 @@ else:
|
||||||
# find all non-excluded files in current directory
|
# find all non-excluded files in current directory
|
||||||
files_dict = cast(Dict[str, List[str]],
|
files_dict = cast(Dict[str, List[str]],
|
||||||
lister.list_files(targets=args.targets, ftypes=['py', 'pyi'],
|
lister.list_files(targets=args.targets, ftypes=['py', 'pyi'],
|
||||||
use_shebang=args.scripts_only, modified_only=args.modified,
|
use_shebang=True, modified_only=args.modified,
|
||||||
exclude = exclude + ['stubs'], group_by_ftype=True,
|
exclude = exclude + ['stubs'], group_by_ftype=True,
|
||||||
extless_only=args.scripts_only))
|
extless_only=args.scripts_only))
|
||||||
pyi_files = set(files_dict['pyi'])
|
pyi_files = set(files_dict['pyi'])
|
||||||
|
@ -127,17 +127,14 @@ if args.disallow_untyped_defs:
|
||||||
|
|
||||||
# run mypy
|
# run mypy
|
||||||
if python_files:
|
if python_files:
|
||||||
if args.scripts_only:
|
rc = subprocess.call([mypy_command] + extra_args + python_files)
|
||||||
rc = subprocess.call([mypy_command] + extra_args + python_files)
|
if args.linecoverage_report:
|
||||||
else:
|
# Move the coverage report to where coveralls will look for it.
|
||||||
rc = subprocess.call([mypy_command] + extra_args + python_files)
|
try:
|
||||||
if args.linecoverage_report:
|
os.rename('var/linecoverage-report/coverage.txt', 'var/.coverage')
|
||||||
# Move the coverage report to where coveralls will look for it.
|
except OSError:
|
||||||
try:
|
# maybe mypy crashed; exit with its error code
|
||||||
os.rename('var/linecoverage-report/coverage.txt', 'var/.coverage')
|
pass
|
||||||
except OSError:
|
|
||||||
# maybe mypy crashed; exit with its error code
|
|
||||||
pass
|
|
||||||
sys.exit(rc)
|
sys.exit(rc)
|
||||||
else:
|
else:
|
||||||
print("There are no files to run mypy on.")
|
print("There are no files to run mypy on.")
|
||||||
|
|
|
@ -4,8 +4,6 @@ retcode=0
|
||||||
set -x
|
set -x
|
||||||
./tools/run-mypy --py2 --linecoverage-report || retcode=1
|
./tools/run-mypy --py2 --linecoverage-report || retcode=1
|
||||||
./tools/run-mypy --py3 || retcode=1
|
./tools/run-mypy --py3 || retcode=1
|
||||||
./tools/run-mypy --py2 --scripts-only --no-disallow-untyped-defs || retcode=1
|
|
||||||
./tools/run-mypy --py3 --scripts-only --no-disallow-untyped-defs || retcode=1
|
|
||||||
set +x
|
set +x
|
||||||
|
|
||||||
if [ "$retcode" == "0" ]; then
|
if [ "$retcode" == "0" ]; then
|
||||||
|
|
Loading…
Reference in New Issue