Skip to content

Commit 3178267

Browse files
Make --todo output more prominent in results
Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
1 parent 346f9b7 commit 3178267

File tree

8 files changed

+112
-48
lines changed

8 files changed

+112
-48
lines changed

src/licensedcode/plugin_license.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class LicenseScanner(ScanPlugin):
7878
)
7979

8080
run_order = 4
81-
sort_order = 4
81+
sort_order = 5
8282

8383
options = [
8484
PluggableCommandLineOption(('-l', '--license'),

src/packagedcode/plugin_package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class PackageScanner(ScanPlugin):
146146
required_plugins = ['scan:licenses']
147147

148148
run_order = 3
149-
sort_order = 3
149+
sort_order = 4
150150

151151
options = [
152152
PluggableCommandLineOption(

src/summarycode/todo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class AmbiguousDetectionsToDoPlugin(PostScanPlugin):
7070
"""
7171
Summarize a scan by compiling review items of ambiguous detections.
7272
"""
73-
sort_order = 10
73+
sort_order = 3
7474

7575
resource_attributes = dict(for_todo=attr.ib(default=attr.Factory(list)))
7676
codebase_attributes = dict(todo=attr.ib(default=attr.Factory(list)))

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

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11
{
2+
"summary": {
3+
"declared_license_expression": "mit",
4+
"license_clarity_score": {
5+
"score": 100,
6+
"declared_license": true,
7+
"identification_precision": true,
8+
"has_license_text": true,
9+
"declared_copyrights": true,
10+
"conflicting_license_categories": false,
11+
"ambiguous_compound_licensing": false
12+
},
13+
"declared_holder": "Niklas von Hertzen",
14+
"primary_language": "JavaScript",
15+
"other_license_expressions": [
16+
{
17+
"value": null,
18+
"count": 1
19+
}
20+
],
21+
"other_holders": [
22+
{
23+
"value": null,
24+
"count": 2
25+
}
26+
],
27+
"other_languages": []
28+
},
29+
"todo": [],
230
"packages": [
331
{
432
"type": "npm",
@@ -309,7 +337,6 @@
309337
]
310338
}
311339
],
312-
"todo": [],
313340
"files": [
314341
{
315342
"path": "base64-arraybuffer-0.1.4",
@@ -330,6 +357,12 @@
330357
"is_media": false,
331358
"is_source": false,
332359
"is_script": false,
360+
"for_todo": [],
361+
"is_legal": false,
362+
"is_manifest": false,
363+
"is_readme": false,
364+
"is_top_level": true,
365+
"is_key_file": false,
333366
"package_data": [],
334367
"for_packages": [],
335368
"detected_license_expression": null,
@@ -340,7 +373,6 @@
340373
"copyrights": [],
341374
"holders": [],
342375
"authors": [],
343-
"for_todo": [],
344376
"files_count": 5,
345377
"dirs_count": 1,
346378
"size_count": 4564,
@@ -365,6 +397,12 @@
365397
"is_media": false,
366398
"is_source": false,
367399
"is_script": false,
400+
"for_todo": [],
401+
"is_legal": false,
402+
"is_manifest": false,
403+
"is_readme": false,
404+
"is_top_level": true,
405+
"is_key_file": false,
368406
"package_data": [],
369407
"for_packages": [
370408
"pkg:npm/base64-arraybuffer@0.1.4?uuid=fixed-uid-done-for-testing-5642512d1758"
@@ -377,7 +415,6 @@
377415
"copyrights": [],
378416
"holders": [],
379417
"authors": [],
380-
"for_todo": [],
381418
"files_count": 0,
382419
"dirs_count": 0,
383420
"size_count": 0,
@@ -402,6 +439,12 @@
402439
"is_media": false,
403440
"is_source": false,
404441
"is_script": false,
442+
"for_todo": [],
443+
"is_legal": true,
444+
"is_manifest": false,
445+
"is_readme": false,
446+
"is_top_level": true,
447+
"is_key_file": true,
405448
"package_data": [],
406449
"for_packages": [
407450
"pkg:npm/base64-arraybuffer@0.1.4?uuid=fixed-uid-done-for-testing-5642512d1758"
@@ -448,7 +491,6 @@
448491
}
449492
],
450493
"authors": [],
451-
"for_todo": [],
452494
"files_count": 0,
453495
"dirs_count": 0,
454496
"size_count": 0,
@@ -473,6 +515,12 @@
473515
"is_media": false,
474516
"is_source": false,
475517
"is_script": false,
518+
"for_todo": [],
519+
"is_legal": false,
520+
"is_manifest": false,
521+
"is_readme": true,
522+
"is_top_level": true,
523+
"is_key_file": true,
476524
"package_data": [],
477525
"for_packages": [
478526
"pkg:npm/base64-arraybuffer@0.1.4?uuid=fixed-uid-done-for-testing-5642512d1758"
@@ -519,7 +567,6 @@
519567
}
520568
],
521569
"authors": [],
522-
"for_todo": [],
523570
"files_count": 0,
524571
"dirs_count": 0,
525572
"size_count": 0,
@@ -544,6 +591,12 @@
544591
"is_media": false,
545592
"is_source": false,
546593
"is_script": false,
594+
"for_todo": [],
595+
"is_legal": false,
596+
"is_manifest": false,
597+
"is_readme": false,
598+
"is_top_level": true,
599+
"is_key_file": false,
547600
"package_data": [],
548601
"for_packages": [
549602
"pkg:npm/base64-arraybuffer@0.1.4?uuid=fixed-uid-done-for-testing-5642512d1758"
@@ -556,7 +609,6 @@
556609
"copyrights": [],
557610
"holders": [],
558611
"authors": [],
559-
"for_todo": [],
560612
"files_count": 1,
561613
"dirs_count": 0,
562614
"size_count": 1704,
@@ -581,6 +633,12 @@
581633
"is_media": false,
582634
"is_source": true,
583635
"is_script": false,
636+
"for_todo": [],
637+
"is_legal": false,
638+
"is_manifest": false,
639+
"is_readme": false,
640+
"is_top_level": false,
641+
"is_key_file": false,
584642
"package_data": [],
585643
"for_packages": [
586644
"pkg:npm/base64-arraybuffer@0.1.4?uuid=fixed-uid-done-for-testing-5642512d1758"
@@ -627,7 +685,6 @@
627685
}
628686
],
629687
"authors": [],
630-
"for_todo": [],
631688
"files_count": 0,
632689
"dirs_count": 0,
633690
"size_count": 0,
@@ -652,6 +709,12 @@
652709
"is_media": false,
653710
"is_source": false,
654711
"is_script": false,
712+
"for_todo": [],
713+
"is_legal": false,
714+
"is_manifest": false,
715+
"is_readme": false,
716+
"is_top_level": false,
717+
"is_key_file": false,
655718
"package_data": [
656719
{
657720
"type": "npm",
@@ -864,7 +927,6 @@
864927
"end_line": 7
865928
}
866929
],
867-
"for_todo": [],
868930
"files_count": 0,
869931
"dirs_count": 0,
870932
"size_count": 0,

tests/summarycode/data/todo/todo_present/README.multi-orig-tarball-package-expected-diag.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"license_detections": [],
32
"todo": [
43
{
54
"detection_id": "borceux-d99f172d-bc25-b4f7-b6bf-cccec1995ce5",
@@ -39,10 +38,14 @@
3938
}
4039
}
4140
],
41+
"license_detections": [],
4242
"files": [
4343
{
4444
"path": "README.multi-orig-tarball-package",
4545
"type": "file",
46+
"for_todo": [
47+
"borceux-d99f172d-bc25-b4f7-b6bf-cccec1995ce5"
48+
],
4649
"detected_license_expression": null,
4750
"detected_license_expression_spdx": null,
4851
"license_detections": [],
@@ -65,9 +68,6 @@
6568
}
6669
],
6770
"percentage_of_license_text": 10.53,
68-
"for_todo": [
69-
"borceux-d99f172d-bc25-b4f7-b6bf-cccec1995ce5"
70-
],
7171
"scan_errors": []
7272
}
7373
]

tests/summarycode/data/todo/todo_present/incomplete-setup-cfg-expected.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
2-
"packages": [],
3-
"dependencies": [],
42
"todo": [
53
{
64
"detection_id": "pkg:pypi/scancode-toolkit-e7ce965e-449d-5c31-b5e4-5ad0dfd29f5c",
@@ -53,10 +51,15 @@
5351
}
5452
}
5553
],
54+
"packages": [],
55+
"dependencies": [],
5656
"files": [
5757
{
5858
"path": "incomplete-setup.cfg",
5959
"type": "file",
60+
"for_todo": [
61+
"pkg:pypi/scancode-toolkit-e7ce965e-449d-5c31-b5e4-5ad0dfd29f5c"
62+
],
6063
"package_data": [
6164
{
6265
"type": "pypi",
@@ -104,9 +107,6 @@
104107
}
105108
],
106109
"for_packages": [],
107-
"for_todo": [
108-
"pkg:pypi/scancode-toolkit-e7ce965e-449d-5c31-b5e4-5ad0dfd29f5c"
109-
],
110110
"scan_errors": []
111111
}
112112
]

tests/summarycode/data/todo/todo_present/unknown-license-expected.json

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,4 @@
11
{
2-
"license_detections": [
3-
{
4-
"identifier": "unknown-b0897d47-1c91-9898-2364-2e4d1a34b6fd",
5-
"license_expression": "unknown",
6-
"license_expression_spdx": "LicenseRef-scancode-unknown",
7-
"detection_count": 1,
8-
"reference_matches": [
9-
{
10-
"license_expression": "unknown",
11-
"license_expression_spdx": "LicenseRef-scancode-unknown",
12-
"from_file": "unknown-license.txt",
13-
"start_line": 1,
14-
"end_line": 10,
15-
"matcher": "6-unknown",
16-
"score": 86.89,
17-
"matched_length": 53,
18-
"match_coverage": 100.0,
19-
"rule_relevance": 100,
20-
"rule_identifier": "license-detection-unknown-51bcd994ad60981fff8c5f1b1b9af6e3d4f5ba67",
21-
"rule_url": null,
22-
"matched_text": "form shall mean the preferred form for making\nthe purposes of this definition control\nsoftware is modified by someone else\n\n\n\nrepresent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof."
23-
}
24-
]
25-
}
26-
],
272
"todo": [
283
{
294
"detection_id": "unknown-b0897d47-1c91-9898-2364-2e4d1a34b6fd",
@@ -60,10 +35,38 @@
6035
}
6136
}
6237
],
38+
"license_detections": [
39+
{
40+
"identifier": "unknown-b0897d47-1c91-9898-2364-2e4d1a34b6fd",
41+
"license_expression": "unknown",
42+
"license_expression_spdx": "LicenseRef-scancode-unknown",
43+
"detection_count": 1,
44+
"reference_matches": [
45+
{
46+
"license_expression": "unknown",
47+
"license_expression_spdx": "LicenseRef-scancode-unknown",
48+
"from_file": "unknown-license.txt",
49+
"start_line": 1,
50+
"end_line": 10,
51+
"matcher": "6-unknown",
52+
"score": 86.89,
53+
"matched_length": 53,
54+
"match_coverage": 100.0,
55+
"rule_relevance": 100,
56+
"rule_identifier": "license-detection-unknown-51bcd994ad60981fff8c5f1b1b9af6e3d4f5ba67",
57+
"rule_url": null,
58+
"matched_text": "form shall mean the preferred form for making\nthe purposes of this definition control\nsoftware is modified by someone else\n\n\n\nrepresent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof."
59+
}
60+
]
61+
}
62+
],
6363
"files": [
6464
{
6565
"path": "unknown-license.txt",
6666
"type": "file",
67+
"for_todo": [
68+
"unknown-b0897d47-1c91-9898-2364-2e4d1a34b6fd"
69+
],
6770
"detected_license_expression": "unknown",
6871
"detected_license_expression_spdx": "LicenseRef-scancode-unknown",
6972
"license_detections": [
@@ -92,9 +95,6 @@
9295
],
9396
"license_clues": [],
9497
"percentage_of_license_text": 86.89,
95-
"for_todo": [
96-
"unknown-b0897d47-1c91-9898-2364-2e4d1a34b6fd"
97-
],
9898
"scan_errors": []
9999
}
100100
]

tests/summarycode/test_todo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def test_end2end_todo_works_on_codebase_without_ambiguous_detections(self):
3030
run_scan_click([
3131
'-clip',
3232
'--todo',
33+
'--classify',
34+
'--summary',
3335
'--json-pp', result_file, test_dir
3436
])
3537
check_json_scan(expected_file, result_file, remove_uuid=True, remove_file_date=True, regen=REGEN_TEST_FIXTURES)

0 commit comments

Comments
 (0)