MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / _validate_all_rules

Function _validate_all_rules

src/licensedcode/models.py:1083–1095  ·  view source on GitHub ↗

Return a mapping of {error message: [list of Rule]} from validating a list of ``rules`` Rule integrity and correctness using known licenses from a mapping of ``licenses_by_key`` {key: License}`.

(rules, licenses_by_key, thorough=False)

Source from the content-addressed store, hash-verified

1081
1082
1083def _validate_all_rules(rules, licenses_by_key, thorough=False):
1084 """
1085 Return a mapping of {error message: [list of Rule]} from validating a list
1086 of ``rules`` Rule integrity and correctness using known licenses from a
1087 mapping of ``licenses_by_key`` {key: License}`.
1088 """
1089 licensing = Licensing(symbols=licenses_by_key.values())
1090 errors = defaultdict(list)
1091
1092 for rule in rules:
1093 for err_msg in rule.validate(licensing, thorough=thorough):
1094 errors[err_msg].append(rule)
1095 return errors
1096
1097
1098def validate_rules(rules, licenses_by_key, with_text=False, rules_data_dir=rules_data_dir, thorough=False):

Callers 1

validate_rulesFunction · 0.85

Calls 3

valuesMethod · 0.45
validateMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected