From 0ce4de042195b03e16a1925bd73f2a148351dfae Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 13 Nov 2019 12:55:27 -0800 Subject: [PATCH] lint: Run mypy with --no-error-summary. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tools/lint | 2 +- tools/run-mypy | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/lint b/tools/lint index 9a5f1e6280..cd2f390267 100755 --- a/tools/lint +++ b/tools/lint @@ -79,7 +79,7 @@ def run(): "(zerver/openapi/zulip.yaml) ") linter_config.external_linter('shellcheck', ['shellcheck', '-x'], ['sh'], description="Standard shell script linter.") - command = ['tools/run-mypy'] + command = ['tools/run-mypy', '--quiet'] if args.force: command.append('--force') linter_config.external_linter('mypy', command, ['py'], pass_targets=False, diff --git a/tools/run-mypy b/tools/run-mypy index c0857b7479..c1ecdfac2d 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -5,6 +5,7 @@ import os import sys import argparse import subprocess +from typing import List 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") parser.add_argument('--force', action="store_true", help="run tests despite possible provisioning problems") +parser.add_argument("--quiet", action="store_true", + help="suppress mypy summary output") args = parser.parse_args() 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.") 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) if rc != 0: