Return True if a `detected license` mapping is considered to be a high quality conclusive match.
(license_match_object)
| 255 | |
| 256 | |
| 257 | def is_good_license(license_match_object): |
| 258 | """ |
| 259 | Return True if a `detected license` mapping is considered to be a high quality |
| 260 | conclusive match. |
| 261 | """ |
| 262 | score = license_match_object.score() |
| 263 | coverage = license_match_object.coverage() |
| 264 | relevance = license_match_object.rule.relevance |
| 265 | match_types = dict( |
| 266 | [ |
| 267 | ('is_license_text', license_match_object.rule.is_license_text), |
| 268 | ('is_license_notice', license_match_object.rule.is_license_notice), |
| 269 | ('is_license_reference', license_match_object.rule.is_license_reference), |
| 270 | ('is_license_tag', license_match_object.rule.is_license_tag), |
| 271 | ('is_license_intro', license_match_object.rule.is_license_intro), |
| 272 | ('is_license_clue', license_match_object.rule.is_license_clue), |
| 273 | ] |
| 274 | ) |
| 275 | matched = False |
| 276 | for match_type, mval in match_types.items(): |
| 277 | if mval: |
| 278 | matched = True |
| 279 | break |
| 280 | if not matched: |
| 281 | return False |
| 282 | |
| 283 | thresholds = FILTERS[match_type] |
| 284 | |
| 285 | if not coverage or not relevance: |
| 286 | if score >= thresholds.min_score: |
| 287 | return True |
| 288 | else: |
| 289 | if ( |
| 290 | score >= thresholds.min_score |
| 291 | and coverage >= thresholds.min_coverage |
| 292 | and relevance >= thresholds.min_relevance |
| 293 | ): |
| 294 | return True |
| 295 | |
| 296 | return False |
| 297 | |
| 298 | |
| 299 | def check_declared_licenses(license_match_objects): |
no test coverage detected