Return True if all of the matches in ``license_matches`` List of LicenseMatch are false positives. False Positive occurs when other text/code is falsely matched to a license rule,
(license_matches, package_license=False)
| 1160 | |
| 1161 | |
| 1162 | def is_false_positive(license_matches, package_license=False): |
| 1163 | """ |
| 1164 | Return True if all of the matches in ``license_matches`` List of LicenseMatch |
| 1165 | are false positives. |
| 1166 | |
| 1167 | False Positive occurs when other text/code is falsely matched to a license rule, |
| 1168 | """ |
| 1169 | if package_license: |
| 1170 | return False |
| 1171 | |
| 1172 | # FIXME: actually run copyright detection here? |
| 1173 | copyright_words = ["copyright", "(c)"] |
| 1174 | has_copyrights = all( |
| 1175 | any( |
| 1176 | word in license_match.matched_text().lower() |
| 1177 | for word in copyright_words |
| 1178 | ) |
| 1179 | for license_match in license_matches |
| 1180 | ) |
| 1181 | has_full_relevance = all( |
| 1182 | license_match.rule.relevance == 100 |
| 1183 | for license_match in license_matches |
| 1184 | ) |
| 1185 | if has_copyrights or has_full_relevance: |
| 1186 | return False |
| 1187 | |
| 1188 | has_low_relevance = all( |
| 1189 | license_match.rule.relevance < 60 |
| 1190 | for license_match in license_matches |
| 1191 | ) |
| 1192 | |
| 1193 | start_line_region = min( |
| 1194 | license_match.start_line for license_match in license_matches |
| 1195 | ) |
| 1196 | match_rule_length_values = [ |
| 1197 | license_match.rule.length for license_match in license_matches |
| 1198 | ] |
| 1199 | |
| 1200 | all_match_rule_length_one = all( |
| 1201 | match_rule_length == 1 |
| 1202 | for match_rule_length in match_rule_length_values |
| 1203 | ) |
| 1204 | bare_rules = ['gpl_bare', 'freeware_bare', 'public-domain_bare'] |
| 1205 | is_bare_rule = all( |
| 1206 | any([ |
| 1207 | bare_rule in license_match.rule.identifier |
| 1208 | for bare_rule in bare_rules |
| 1209 | ]) |
| 1210 | for license_match in license_matches |
| 1211 | ) |
| 1212 | |
| 1213 | is_gpl = all( |
| 1214 | 'gpl' in license_match.rule.identifier |
| 1215 | for license_match in license_matches |
| 1216 | ) |
| 1217 | |
| 1218 | matches_is_license_tag_flags = all( |
| 1219 | license_match.rule.is_license_tag for license_match in license_matches |
no test coverage detected