Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/dmypy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions mypy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 13 additions & 6 deletions mypy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down