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 1111import os
1212
1313import saneyaml
14+ from license_expression import Licensing
1415
1516from licensedcode .cache import build_spdx_license_expression
1617from licensedcode .cache import get_cache
@@ -579,13 +580,19 @@ def get_license_expression_from_detection_mappings(
579580 )
580581
581582
582- def matches_have_unknown (matches ):
583+ def matches_have_unknown (matches , licensing = Licensing () ):
583584 """
584585 Return True if any of the LicenseMatch in ``matches`` has an unknown license.
585586 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
589596
590597
591598def get_license_detections_from_matches (matches ):
You can’t perform that action at this time.
0 commit comments