lint: Run mypy with --no-error-summary.

This suppresses the mypy message “Success: no issues found in 1085
source files” or “Found 1 error in 1 file (checked 1085 source files)”
in the output of lint.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
Anders Kaseorg 2019-11-13 12:55:27 -08:00 committed by Anders Kaseorg
parent 2c4101dbc5
commit 0ce4de0421
2 changed files with 8 additions and 2 deletions

View File

@ -79,7 +79,7 @@ def run():
"(zerver/openapi/zulip.yaml) ") "(zerver/openapi/zulip.yaml) ")
linter_config.external_linter('shellcheck', ['shellcheck', '-x'], ['sh'], linter_config.external_linter('shellcheck', ['shellcheck', '-x'], ['sh'],
description="Standard shell script linter.") description="Standard shell script linter.")
command = ['tools/run-mypy'] command = ['tools/run-mypy', '--quiet']
if args.force: if args.force:
command.append('--force') command.append('--force')
linter_config.external_linter('mypy', command, ['py'], pass_targets=False, linter_config.external_linter('mypy', command, ['py'], pass_targets=False,

View File

@ -5,6 +5,7 @@ import os
import sys import sys
import argparse import argparse
import subprocess import subprocess
from typing import List
from zulint import lister from zulint import lister
@ -31,6 +32,8 @@ parser.add_argument('-a', '--all', action='store_true',
help="check all files, bypassing the default exclude list") help="check all files, bypassing the default exclude list")
parser.add_argument('--force', action="store_true", parser.add_argument('--force', action="store_true",
help="run tests despite possible provisioning problems") help="run tests despite possible provisioning problems")
parser.add_argument("--quiet", action="store_true",
help="suppress mypy summary output")
args = parser.parse_args() args = parser.parse_args()
assert_provisioning_status_ok(args.force) assert_provisioning_status_ok(args.force)
@ -66,7 +69,10 @@ if not python_files and not pyi_files:
print("There are no files to run mypy on.") print("There are no files to run mypy on.")
sys.exit(0) sys.exit(0)
mypy_args = python_files + pyi_files mypy_args = [] # type: List[str]
if args.quiet:
mypy_args += ["--no-error-summary"]
mypy_args += ["--"] + python_files + pyi_files
rc = subprocess.call([mypy_command] + mypy_args) rc = subprocess.call([mypy_command] + mypy_args)
if rc != 0: if rc != 0: