Skip to content

Commit 243ba18

Browse files
committed
Consider clues in false positive filter
is_candidate_false_positive() now also considers license_clues as eligible for false poistive filtering. Signed-off-by: Philippe Ombredanne <[email protected]>
1 parent 2607e0d commit 243ba18

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/licensedcode/match.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,7 @@ def filter_invalid_matches_to_single_word_gibberish(
18211821
18221822
- the scanned file is a binary file (we could relax this in the future
18231823
- the matched rule has a single word (length 1)
1824-
- the matched rule "is_license_reference: yes"
1824+
- the matched rule "is_license_reference" or "is_license_clue"
18251825
- the matched rule has a low relevance, e.g., under 75
18261826
- the matched text has either:
18271827
- one or more leading or trailing punctuations (except for +)
@@ -2628,8 +2628,13 @@ def is_candidate_false_positive(
26282628
license list match.
26292629
"""
26302630
is_candidate = (
2631-
# only tags or refs,
2632-
(match.rule.is_license_reference or match.rule.is_license_tag or match.rule.is_license_intro)
2631+
# only tags, refs, or clues
2632+
(
2633+
match.rule.is_license_reference
2634+
or match.rule.is_license_tag
2635+
or match.rule.is_license_intro
2636+
or match.rule.is_license_clue
2637+
)
26332638
# but not tags that are SPDX license identifiers
26342639
and not match.matcher == '1-spdx-id'
26352640
# exact matches only
@@ -2644,6 +2649,8 @@ def is_candidate_false_positive(
26442649
print(' is_candidate_false_positive:', is_candidate,
26452650
'is_license_reference:', match.rule.is_license_reference,
26462651
'is_license_tag:', match.rule.is_license_tag,
2652+
'is_license_intro:', match.rule.is_license_intro,
2653+
'is_license_clue:', match.rule.is_license_clue,
26472654
'coverage:', match.coverage(),
26482655
'match.len():', match.len(), '<=', 'max_length:', max_length,
26492656
':', match.len() <= max_length

0 commit comments

Comments
 (0)