mirror of https://github.com/zulip/zulip.git
run-mypy: Deindent a bit of logic by moving an exit path up.
This commit is contained in:
parent
103178ffb2
commit
704e94c85c
|
@ -83,6 +83,9 @@ files_dict = cast(Dict[str, List[str]],
|
|||
pyi_files = set(files_dict['pyi'])
|
||||
python_files = [fpath for fpath in files_dict['py']
|
||||
if not fpath.endswith('.py') or fpath + 'i' not in pyi_files]
|
||||
if not python_files:
|
||||
print("There are no files to run mypy on.")
|
||||
sys.exit(0)
|
||||
|
||||
extra_args = ["--check-untyped-defs",
|
||||
"--follow-imports=silent",
|
||||
|
@ -102,17 +105,14 @@ if args.ignore_missing_imports:
|
|||
if args.quick:
|
||||
extra_args.append("--quick")
|
||||
|
||||
rc = subprocess.call([mypy_command] + extra_args + python_files)
|
||||
|
||||
# run mypy
|
||||
if python_files:
|
||||
rc = subprocess.call([mypy_command] + extra_args + python_files)
|
||||
if args.linecoverage_report:
|
||||
# Move the coverage report to where codecov 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.")
|
||||
if args.linecoverage_report:
|
||||
# Move the coverage report to where codecov 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)
|
||||
|
|
Loading…
Reference in New Issue