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:
Tim Abbott 2016-10-15 22:48:08 -07:00
parent 4dbdf7e373
commit 9e503f2dcf
2 changed files with 9 additions and 14 deletions

View File

@ -99,7 +99,7 @@ else:
# find all non-excluded files in current directory
files_dict = cast(Dict[str, List[str]],
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,
extless_only=args.scripts_only))
pyi_files = set(files_dict['pyi'])
@ -127,17 +127,14 @@ if args.disallow_untyped_defs:
# run mypy
if python_files:
if args.scripts_only:
rc = subprocess.call([mypy_command] + extra_args + python_files)
else:
rc = subprocess.call([mypy_command] + extra_args + python_files)
if args.linecoverage_report:
# Move the coverage report to where coveralls will look for it.
try:
os.rename('var/linecoverage-report/coverage.txt', 'var/.coverage')
except OSError:
# maybe mypy crashed; exit with its error code
pass
rc = subprocess.call([mypy_command] + extra_args + python_files)
if args.linecoverage_report:
# Move the coverage report to where coveralls will look for it.
try:
os.rename('var/linecoverage-report/coverage.txt', 'var/.coverage')
except OSError:
# maybe mypy crashed; exit with its error code
pass
sys.exit(rc)
else:
print("There are no files to run mypy on.")

View File

@ -4,8 +4,6 @@ retcode=0
set -x
./tools/run-mypy --py2 --linecoverage-report || 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
if [ "$retcode" == "0" ]; then