Skip to content

Commit e5d2fd5

Browse files
Add support for license clues in --todo
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
1 parent f885196 commit e5d2fd5

16 files changed

Lines changed: 91 additions & 2 deletions

src/licensedcode/detection.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,10 @@ def get_ambiguous_license_detections_by_type(unique_license_detections):
13411341
ambi_license_detections = {}
13421342

13431343
for detection in unique_license_detections:
1344-
if is_undetected_license_matches(license_matches=detection.matches):
1344+
if not detection.license_expression:
1345+
ambi_license_detections[DetectionCategory.MATCH_FRAGMENTS.value] = detection
1346+
1347+
elif is_undetected_license_matches(license_matches=detection.matches):
13451348
ambi_license_detections[DetectionCategory.UNDETECTED_LICENSE.value] = detection
13461349

13471350
elif "unknown" in detection.license_expression:

src/summarycode/todo.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,9 @@ def get_review_comments(detection_log):
368368
if LicenseDetectionCategory.UNKNOWN_MATCH.value in detection_log:
369369
review_comments[LicenseDetectionCategory.UNKNOWN_MATCH.value] = ReviewComments.UNKNOWN_MATCH.value
370370

371+
if LicenseDetectionCategory.MATCH_FRAGMENTS.value in detection_log:
372+
review_comments[LicenseDetectionCategory.MATCH_FRAGMENTS.value] = ReviewComments.MATCH_FRAGMENTS.value
373+
371374
if LicenseDetectionCategory.LICENSE_CLUES.value in detection_log:
372375
review_comments[LicenseDetectionCategory.LICENSE_CLUES.value] = ReviewComments.LICENSE_CLUES.value
373376

tests/summarycode/data/review/no_todo/base64-arraybuffer-0.1.4/.npmignore renamed to tests/summarycode/data/todo/no_todo/base64-arraybuffer-0.1.4/.npmignore

File renamed without changes.

tests/summarycode/data/review/no_todo/base64-arraybuffer-0.1.4/LICENSE-MIT renamed to tests/summarycode/data/todo/no_todo/base64-arraybuffer-0.1.4/LICENSE-MIT

File renamed without changes.

tests/summarycode/data/review/no_todo/base64-arraybuffer-0.1.4/README.md renamed to tests/summarycode/data/todo/no_todo/base64-arraybuffer-0.1.4/README.md

File renamed without changes.

tests/summarycode/data/review/no_todo/base64-arraybuffer-0.1.4/lib/base64-arraybuffer.js renamed to tests/summarycode/data/todo/no_todo/base64-arraybuffer-0.1.4/lib/base64-arraybuffer.js

File renamed without changes.

tests/summarycode/data/review/no_todo/base64-arraybuffer-0.1.4/package.json renamed to tests/summarycode/data/todo/no_todo/base64-arraybuffer-0.1.4/package.json

File renamed without changes.

tests/summarycode/data/review/no_todo/base64-arraybuffer.expected.json renamed to tests/summarycode/data/todo/no_todo/base64-arraybuffer.expected.json

File renamed without changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This src:package consists of various tarballs.
2+
3+
This README is a dummy file for creating the base tarball of the name
4+
5+
fusiondirectory_<upstream-version>.orig.tar.gz
6+
7+
-- Mike Gabriel <sunweaver@debian.org> Tue, 01 Apr 2014 16:36:31 +0200
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"license_detections": [],
3+
"todo": [
4+
{
5+
"detection_id": null,
6+
"review_comments": {
7+
"match_fragments": "Fragments of license text were detected which are not proper license detections and likely has misleading license expression, but this has some clues about licenses, which needs review."
8+
},
9+
"detection": {
10+
"license_expression": null,
11+
"matches": [
12+
{
13+
"score": 4.71,
14+
"start_line": 1,
15+
"end_line": 3,
16+
"matched_length": 4,
17+
"match_coverage": 4.71,
18+
"matcher": "3-seq",
19+
"license_expression": "borceux",
20+
"rule_identifier": "borceux.LICENSE",
21+
"rule_relevance": 100,
22+
"rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/borceux.LICENSE",
23+
"matched_text": "package consists of [various] [tarballs].\n\n[This] README"
24+
}
25+
],
26+
"detection_log": [
27+
"license-clues"
28+
],
29+
"identifier": null
30+
}
31+
}
32+
],
33+
"files": [
34+
{
35+
"path": "README.multi-orig-tarball-package",
36+
"type": "file",
37+
"detected_license_expression": null,
38+
"detected_license_expression_spdx": null,
39+
"license_detections": [],
40+
"license_clues": [
41+
{
42+
"score": 4.71,
43+
"start_line": 1,
44+
"end_line": 3,
45+
"matched_length": 4,
46+
"match_coverage": 4.71,
47+
"matcher": "3-seq",
48+
"license_expression": "borceux",
49+
"rule_identifier": "borceux.LICENSE",
50+
"rule_relevance": 100,
51+
"rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/borceux.LICENSE",
52+
"matched_text": "package consists of [various] [tarballs].\n\n[This] README"
53+
}
54+
],
55+
"percentage_of_license_text": 10.53,
56+
"for_todo": [
57+
null
58+
],
59+
"scan_errors": []
60+
}
61+
]
62+
}

0 commit comments

Comments
 (0)