-
-
Notifications
You must be signed in to change notification settings - Fork 773
Fix masked license validation test names (#5257) #5263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you reuse this, |
||
|
|
||
| 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you directly use the assert on the list comprehension? |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like more the rule renames at https://github.com/aboutcode-org/scancode-toolkit/pull/5258/changes
cnri-python-1.6_1.RULE->cnri-python-1.6_19.RULEproprietary_10_alt.RULE->proprietary_155.RULE