diff --git a/mypy/dmypy_server.py b/mypy/dmypy_server.py index 157850b39ee9..8762a05ecf94 100644 --- a/mypy/dmypy_server.py +++ b/mypy/dmypy_server.py @@ -743,7 +743,7 @@ def pretty_messages(self, messages: List[str], n_sources: int, n_errors, n_files = count_stats(messages) if n_errors: summary = self.formatter.format_error(n_errors, n_files, n_sources, - use_color) + use_color=use_color) else: summary = self.formatter.format_success(n_sources, use_color) if summary: diff --git a/mypy/main.py b/mypy/main.py index 74758b40513e..7de1f57dfece 100644 --- a/mypy/main.py +++ b/mypy/main.py @@ -111,11 +111,13 @@ def flush_errors(new_messages: List[str], serious: bool) -> None: if messages: n_errors, n_files = util.count_stats(messages) if n_errors: - stdout.write(formatter.format_error(n_errors, n_files, len(sources), - options.color_output) + '\n') + summary = formatter.format_error( + n_errors, n_files, len(sources), blockers=blockers, + use_color=options.color_output + ) + stdout.write(summary + '\n') else: - stdout.write(formatter.format_success(len(sources), - options.color_output) + '\n') + stdout.write(formatter.format_success(len(sources), options.color_output) + '\n') stdout.flush() if options.fast_exit: # Exit without freeing objects -- it's faster. diff --git a/mypy/util.py b/mypy/util.py index 8481bab69ee9..f148f5272d8a 100644 --- a/mypy/util.py +++ b/mypy/util.py @@ -677,13 +677,20 @@ def format_success(self, n_sources: int, use_color: bool = True) -> str: return msg return self.style(msg, 'green', bold=True) - def format_error(self, n_errors: int, n_files: int, n_sources: int, - use_color: bool = True) -> str: + def format_error( + self, n_errors: int, n_files: int, n_sources: int, *, + blockers: bool = False, use_color: bool = True + ) -> str: """Format a short summary in case of errors.""" - msg = 'Found {} error{} in {} file{}' \ - ' (checked {} source file{})'.format(n_errors, 's' if n_errors != 1 else '', - n_files, 's' if n_files != 1 else '', - n_sources, 's' if n_sources != 1 else '') + + msg = 'Found {} error{} in {} file{}'.format( + n_errors, 's' if n_errors != 1 else '', + n_files, 's' if n_files != 1 else '' + ) + if blockers: + msg += ' (errors prevented further checking)' + else: + msg += ' (checked {} source file{})'.format(n_sources, 's' if n_sources != 1 else '') if not use_color: return msg return self.style(msg, 'red', bold=True)