Skip to content

Commit 7212179

Browse files
committed
Fix bug in any and all conditions
Due to wrong handling of any and all functions license matches are categorized as having full relevance or copyrights, even if they do not. This leads to a regression in false positive detection. Correct the any and all conditions to correctly detect copyrights and relevance. Signed-off-by: alexzurbonsen <[email protected]>
1 parent c40476a commit 7212179

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/licensedcode/detection.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,18 +1166,15 @@ def is_false_positive(license_matches, package_license=False):
11661166
# FIXME: actually run copyright detection here?
11671167
copyright_words = ["copyright", "(c)"]
11681168
has_copyrights = all(
1169-
True
1170-
for license_match in license_matches
1171-
if any(
1172-
True
1169+
any(
1170+
word in license_match.matched_text().lower()
11731171
for word in copyright_words
1174-
if word in license_match.matched_text().lower()
1175-
)
1172+
)
1173+
for license_match in license_matches
11761174
)
11771175
has_full_relevance = all(
1178-
True
1176+
license_match.rule.relevance == 100
11791177
for license_match in license_matches
1180-
if license_match.rule.relevance == 100
11811178
)
11821179
if has_copyrights or has_full_relevance:
11831180
return False

0 commit comments

Comments
 (0)