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 @@ -102,6 +102,7 @@ The following organizations or individuals have contributed to ScanCode:
- Vibhu Agarwal @Vibhu-Agarwal
- Viktor Tiulpin @tiulpin
- Vinay Kumar Singh @Vinay0001
- w3lld1 @w3lld1
- Virag Umathe @viragumathe5
- Yash D. Saraf @yashdsaraf
- Yash Nisar @yash-nisar
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
Next release
--------------

- Ensure each license rule has a unique generated validation test name.
https://github.com/aboutcode-org/scancode-toolkit/issues/5257

- Fix the optional ``licenses`` extra dependency typo to install
``licensedcode-data``.
https://github.com/aboutcode-org/scancode-toolkit/pull/5056
Expand Down
4 changes: 2 additions & 2 deletions tests/licensedcode/test_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,8 +1075,8 @@ def test_match_has_correct_line_positions_in_automake_perl_file(self):
expected = [
# detected, match.lines(), match.qspan,
('gpl-2.0-plus', (12, 25), Span(51, 160)),
('fsf-unlimited-no-warranty', (231, 238), Span(986, 1049)),
('warranty-disclaimer', (306, 307), Span(1359, 1381)),
('fsf-unlimited-no-warranty', (231, 238), Span(998, 1061)),
('warranty-disclaimer', (306, 307), Span(1371, 1393)),
]
self.check_position('positions/automake.pl', expected)

Expand Down
32 changes: 32 additions & 0 deletions tests/licensedcode/test_rule_file_names.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more information about nexB OSS projects.
#

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
Loading