Merge pull request #7020 from blueyed/fix-warnings-summary

Fix warnings summary
This commit is contained in:
Ran Benita
2020-05-05 21:58:57 +03:00
committed by GitHub
6 changed files with 75 additions and 48 deletions

View File

@@ -846,7 +846,7 @@ class TerminalReporter:
def collapsed_location_report(reports: List[WarningReport]):
locations = []
for w in warning_reports:
for w in reports:
location = w.get_location(self.config)
if location:
locations.append(location)
@@ -858,16 +858,14 @@ class TerminalReporter:
str(loc).split("::", 1)[0] for loc in locations
)
return "\n".join(
"{0}: {1} test{2} with warning{2}".format(
k, v, "s" if v > 1 else ""
)
"{}: {} warning{}".format(k, v, "s" if v > 1 else "")
for k, v in counts_by_filename.items()
)
title = "warnings summary (final)" if final else "warnings summary"
self.write_sep("=", title, yellow=True, bold=False)
for message, warning_reports in reports_grouped_by_message.items():
maybe_location = collapsed_location_report(warning_reports)
for message, message_reports in reports_grouped_by_message.items():
maybe_location = collapsed_location_report(message_reports)
if maybe_location:
self._tw.line(maybe_location)
lines = message.splitlines()