1
0
Fork 0

Reverse sort by count and item name in the summary

When two files have the same number of warnings, they will appear
in the same order in the summary, making the diff between different
build logs smaller.
This commit is contained in:
Patryk Obara 2019-12-12 16:20:50 +01:00 committed by Patryk Obara
parent 3b5c3beacf
commit 55b716f8ce

View file

@ -74,11 +74,11 @@ def find_longest_name_length(names):
def print_summary(issues):
summary = list(issues.items())
size = find_longest_name_length(issues.keys()) + 1
for warning, count in sorted(summary, key=lambda x: -x[1]):
items = list(issues.items())
for name, count in sorted(items, key=lambda x: (x[1], x[0]), reverse=True):
print(' {text:{field_size}s}: {count}'.format(
text=warning, count=count, field_size=size))
text=name, count=count, field_size=size))
print()