Skip to content

Commit 08c0628

Browse files
committed
Sort license validation messages
This helps to have a stable output when testing Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
1 parent 455285d commit 08c0628

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/licensedcode/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ def validate(licenses, verbose=False, no_dupe_urls=False):
642642
continue
643643
errors['GLOBAL'].append(
644644
f'Duplicate short name (ignoring case): {short_name} in licenses: ' +
645-
', '.join(l.key for l in licenses)
645+
', '.join(sorted(l.key for l in licenses))
646646
)
647647

648648
# global name dedupe
@@ -651,7 +651,7 @@ def validate(licenses, verbose=False, no_dupe_urls=False):
651651
continue
652652
errors['GLOBAL'].append(
653653
f'Duplicate name (ignoring case): {name} in licenses: ' +
654-
', '.join(l.key for l in licenses)
654+
', '.join(sorted(l.key for l in licenses))
655655
)
656656

657657
errors = {k: v for k, v in errors.items() if v}

tests/licensedcode/test_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def test_validate_license_library_can_return_errors(self):
100100
expected_errors = {
101101
'GLOBAL': [
102102
'Duplicate texts in multiple licenses: apache-2.0: TEXT, bsd-ack-carrot2: TEXT',
103-
'Duplicate short name (ignoring case): gpl 1.0 in licenses: gpl-1.0-plus, gpl-1.0',
104-
'Duplicate name (ignoring case): gnu general public license 1.0 in licenses: gpl-1.0-plus, gpl-1.0'],
103+
'Duplicate short name (ignoring case): gpl 1.0 in licenses: gpl-1.0, gpl-1.0-plus',
104+
'Duplicate name (ignoring case): gnu general public license 1.0 in licenses: gpl-1.0, gpl-1.0-plus'],
105105
'bsd-ack-carrot2': [
106106
'No short name',
107107
'No name',

0 commit comments

Comments
 (0)