File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 11
11
import os
12
12
13
13
import saneyaml
14
+ from license_expression import Licensing
14
15
15
16
from licensedcode .cache import build_spdx_license_expression
16
17
from licensedcode .cache import get_cache
@@ -579,13 +580,19 @@ def get_license_expression_from_detection_mappings(
579
580
)
580
581
581
582
582
- def matches_have_unknown (matches ):
583
+ def matches_have_unknown (matches , licensing = Licensing () ):
583
584
"""
584
585
Return True if any of the LicenseMatch in ``matches`` has an unknown license.
585
586
Note that by construction and design, an unknown license must have the word "unknown" in its
586
- license key, so we can shortcut the test with a string check.
587
- """
588
- return any ('unknown' in match .rule .license_expression for match in matches )
587
+ license key, but we only care about two specific license keys, and not all license keys.
588
+ """
589
+ for match in matches :
590
+ exp = match .rule .license_expression_object
591
+ if any (
592
+ key in ('unknown' , 'unknown-spdx' )
593
+ for key in licensing .license_keys (exp )
594
+ ):
595
+ return True
589
596
590
597
591
598
def get_license_detections_from_matches (matches ):
You can’t perform that action at this time.
0 commit comments