Skip to content
Open
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
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,4 @@ The following organizations or individuals have contributed to ScanCode:
- Yash Sharma @yasharmaster
- Yunus Rahbar @yns88
- Stefano Zacchiroli @zacchiro
- Harish Wargad @harishwargad
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Next release
``licensedcode-data``.
https://github.com/aboutcode-org/scancode-toolkit/pull/5056

- Ensure each license rule has a unique generated validation
test name, by renaming colliding rule files and adding a
regression test to prevent rule name collisions.
https://github.com/aboutcode-org/scancode-toolkit/issues/5257


v33.0.0rc1 - 2026-05-14
------------------------

Expand Down
20 changes: 20 additions & 0 deletions tests/licensedcode/test_rule_file_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from collections import defaultdict
from pathlib import Path
from commoncode.text import python_safe_name

RULES_DATA_DIR = Path(__file__).parents[2] / "src" / "licensedcode" / "data" / "rules"

def test_rule_file_names_generate_unique_python_names():
rule_names_by_python_name = defaultdict(list)

for rule_file in RULES_DATA_DIR.glob("*.RULE"):
python_name = python_safe_name(rule_file.name)
rule_names_by_python_name[python_name].append(rule_file.name)

duplicate_names = {
python_name: sorted(rule_names)
for python_name, rule_names in rule_names_by_python_name.items()
if len(rule_names) > 1
}

assert not duplicate_names, duplicate_names