Skip to content

Commit e24d6d3

Browse files
committed
Get canonical version of holder #2972
* Update expected test results * TODO: consider not converting common company names to a canonical form Signed-off-by: Jono Yang <[email protected]>
1 parent 4a67d44 commit e24d6d3

File tree

41 files changed

+3
-1298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3
-1298
lines changed

src/summarycode/summarizer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from cluecode.copyrights import CopyrightDetector
1919
from packagedcode.utils import combine_expressions
2020
from packagedcode import models
21+
from summarycode.copyright_tallies import canonical_holder
2122
from summarycode.score import compute_license_score
2223
from summarycode.score import get_field_values_from_codebase_resources
2324
from summarycode.score import unique
@@ -167,7 +168,7 @@ def get_declared_holders(codebase, holders_tallies):
167168
codebase, 'holders', key_files_only=True
168169
)
169170
entry_by_key_file_holders = {
170-
fingerprints.generate(entry['holder']): entry
171+
fingerprints.generate(canonical_holder(entry['holder'])): entry
171172
for entry in key_file_holders
172173
if entry['holder']
173174
}

tests/summarycode/data/classify/cli.expected.json

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,4 @@
11
{
2-
"headers": [
3-
{
4-
"tool_name": "scancode-toolkit",
5-
"options": {
6-
"input": "<path>",
7-
"--classify": true,
8-
"--info": true,
9-
"--json-pp": "<file>"
10-
},
11-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
12-
"output_format_version": "2.0.0",
13-
"message": null,
14-
"errors": [],
15-
"warnings": [],
16-
"extra_data": {
17-
"system_environment": {
18-
"operating_system": "linux",
19-
"cpu_architecture": "64",
20-
"platform": "Linux-5.4.0-109-generic-x86_64-with-Ubuntu-18.04-bionic",
21-
"platform_version": "#123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022",
22-
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
23-
},
24-
"spdx_license_list_version": "3.16",
25-
"files_count": 8
26-
}
27-
}
28-
],
292
"files": [
303
{
314
"path": "cli",

tests/summarycode/data/facet/cli.expected.json

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,4 @@
11
{
2-
"headers": [
3-
{
4-
"tool_name": "scancode-toolkit",
5-
"options": {
6-
"input": "<path>",
7-
"--facet": [
8-
"dev=*.c",
9-
"tests=*/tests/*",
10-
"data=*.json",
11-
"docs=*/docs/*"
12-
],
13-
"--json-pp": "<file>"
14-
},
15-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
16-
"output_format_version": "2.0.0",
17-
"message": null,
18-
"errors": [],
19-
"warnings": [],
20-
"extra_data": {
21-
"system_environment": {
22-
"operating_system": "linux",
23-
"cpu_architecture": "64",
24-
"platform": "Linux-5.4.0-109-generic-x86_64-with-Ubuntu-18.04-bionic",
25-
"platform_version": "#123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022",
26-
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
27-
},
28-
"spdx_license_list_version": "3.16",
29-
"files_count": 56
30-
}
31-
}
32-
],
332
"files": [
343
{
354
"path": "cli",

tests/summarycode/data/generated/cli.expected.json

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,4 @@
11
{
2-
"headers": [
3-
{
4-
"tool_name": "scancode-toolkit",
5-
"options": {
6-
"input": "<path>",
7-
"--generated": true,
8-
"--json-pp": "<file>"
9-
},
10-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
11-
"output_format_version": "2.0.0",
12-
"message": null,
13-
"errors": [],
14-
"warnings": [],
15-
"extra_data": {
16-
"system_environment": {
17-
"operating_system": "linux",
18-
"cpu_architecture": "64",
19-
"platform": "Linux-5.4.0-109-generic-x86_64-with-Ubuntu-18.04-bionic",
20-
"platform_version": "#123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022",
21-
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
22-
},
23-
"spdx_license_list_version": "3.16",
24-
"files_count": 7
25-
}
26-
}
27-
],
282
"files": [
293
{
304
"path": "simple",

tests/summarycode/data/plugin_consolidate/component-package-build-expected.json

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
11
{
2-
"headers": [
3-
{
4-
"tool_name": "scancode-toolkit",
5-
"options": {
6-
"input": "<path>",
7-
"--consolidate": true,
8-
"--copyright": true,
9-
"--info": true,
10-
"--json": "<file>",
11-
"--license": true,
12-
"--package": true
13-
},
14-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
15-
"output_format_version": "2.0.0",
16-
"message": null,
17-
"errors": [],
18-
"warnings": [
19-
"The --consolidate option will be deprecated in a future version of scancode-toolkit."
20-
],
21-
"extra_data": {
22-
"system_environment": {
23-
"operating_system": "linux",
24-
"cpu_architecture": "64",
25-
"platform": "Linux-5.4.0-109-generic-x86_64-with-Ubuntu-18.04-bionic",
26-
"platform_version": "#123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022",
27-
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
28-
},
29-
"spdx_license_list_version": "3.16",
30-
"files_count": 8
31-
}
32-
}
33-
],
342
"dependencies": [],
353
"packages": [
364
{

tests/summarycode/data/plugin_consolidate/component-package-expected.json

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,4 @@
11
{
2-
"headers": [
3-
{
4-
"tool_name": "scancode-toolkit",
5-
"options": {
6-
"input": "<path>",
7-
"--copyright": true,
8-
"--info": true,
9-
"--json": "<file>",
10-
"--license": true,
11-
"--package": true
12-
},
13-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
14-
"output_format_version": "2.0.0",
15-
"message": null,
16-
"errors": [],
17-
"warnings": [],
18-
"extra_data": {
19-
"system_environment": {
20-
"operating_system": "linux",
21-
"cpu_architecture": "64",
22-
"platform": "Linux-5.4.0-109-generic-x86_64-with-Ubuntu-18.04-bionic",
23-
"platform_version": "#123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022",
24-
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
25-
},
26-
"spdx_license_list_version": "3.16",
27-
"files_count": 7
28-
}
29-
},
30-
{
31-
"tool_name": "scancode-toolkit",
32-
"options": {
33-
"input": "<path>",
34-
"--consolidate": true,
35-
"--from-json": true,
36-
"--json": "<file>"
37-
},
38-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
39-
"output_format_version": "2.0.0",
40-
"message": null,
41-
"errors": [],
42-
"warnings": [
43-
"The --consolidate option will be deprecated in a future version of scancode-toolkit."
44-
],
45-
"extra_data": {
46-
"system_environment": {
47-
"operating_system": "linux",
48-
"cpu_architecture": "64",
49-
"platform": "Linux-5.4.0-109-generic-x86_64-with-Ubuntu-18.04-bionic",
50-
"platform_version": "#123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022",
51-
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
52-
},
53-
"spdx_license_list_version": "3.16",
54-
"files_count": 7
55-
}
56-
}
57-
],
582
"dependencies": [],
593
"packages": [
604
{

tests/summarycode/data/plugin_consolidate/e2fsprogs-expected.json

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,4 @@
11
{
2-
"headers": [
3-
{
4-
"tool_name": "scancode-toolkit",
5-
"options": {
6-
"input": [
7-
"e2fsprogs-1.45.4"
8-
],
9-
"--copyright": true,
10-
"--email": true,
11-
"--info": true,
12-
"--json-pp": "e2fsprogs-1.45.4-a-no-configure.json",
13-
"--license": true,
14-
"--max-in-memory": 0,
15-
"--package": true,
16-
"--processes": "6",
17-
"--url": true
18-
},
19-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
20-
"output_format_version": null,
21-
"message": null,
22-
"errors": [],
23-
"warnings": [],
24-
"extra_data": {
25-
"files_count": 2183
26-
}
27-
},
28-
{
29-
"tool_name": "scancode-toolkit",
30-
"options": {
31-
"input": "<path>",
32-
"--consolidate": true,
33-
"--from-json": true,
34-
"--json": "<file>"
35-
},
36-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
37-
"output_format_version": "2.0.0",
38-
"message": null,
39-
"errors": [],
40-
"warnings": [
41-
"The --consolidate option will be deprecated in a future version of scancode-toolkit."
42-
],
43-
"extra_data": {
44-
"system_environment": {
45-
"operating_system": "linux",
46-
"cpu_architecture": "64",
47-
"platform": "Linux-5.4.0-109-generic-x86_64-with-Ubuntu-18.04-bionic",
48-
"platform_version": "#123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022",
49-
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
50-
},
51-
"spdx_license_list_version": "3.16",
52-
"files_count": 2183
53-
}
54-
}
55-
],
562
"consolidated_components": [
573
{
584
"type": "holders",

tests/summarycode/data/plugin_consolidate/license-holder-rollup-expected.json

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
11
{
2-
"headers": [
3-
{
4-
"tool_name": "scancode-toolkit",
5-
"options": {
6-
"input": "<path>",
7-
"--consolidate": true,
8-
"--copyright": true,
9-
"--info": true,
10-
"--json": "<file>",
11-
"--license": true,
12-
"--package": true
13-
},
14-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
15-
"output_format_version": "2.0.0",
16-
"message": null,
17-
"errors": [],
18-
"warnings": [
19-
"The --consolidate option will be deprecated in a future version of scancode-toolkit."
20-
],
21-
"extra_data": {
22-
"system_environment": {
23-
"operating_system": "linux",
24-
"cpu_architecture": "64",
25-
"platform": "Linux-5.4.0-109-generic-x86_64-with-Ubuntu-18.04-bionic",
26-
"platform_version": "#123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022",
27-
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
28-
},
29-
"spdx_license_list_version": "3.16",
30-
"files_count": 3
31-
}
32-
}
33-
],
342
"dependencies": [],
353
"packages": [],
364
"consolidated_components": [

tests/summarycode/data/plugin_consolidate/multiple-same-holder-and-license-expected.json

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
11
{
2-
"headers": [
3-
{
4-
"tool_name": "scancode-toolkit",
5-
"options": {
6-
"input": "<path>",
7-
"--consolidate": true,
8-
"--copyright": true,
9-
"--info": true,
10-
"--json": "<file>",
11-
"--license": true,
12-
"--package": true
13-
},
14-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
15-
"output_format_version": "2.0.0",
16-
"message": null,
17-
"errors": [],
18-
"warnings": [
19-
"The --consolidate option will be deprecated in a future version of scancode-toolkit."
20-
],
21-
"extra_data": {
22-
"system_environment": {
23-
"operating_system": "linux",
24-
"cpu_architecture": "64",
25-
"platform": "Linux-5.4.0-109-generic-x86_64-with-Ubuntu-18.04-bionic",
26-
"platform_version": "#123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022",
27-
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
28-
},
29-
"spdx_license_list_version": "3.16",
30-
"files_count": 2
31-
}
32-
}
33-
],
342
"dependencies": [],
353
"packages": [],
364
"consolidated_components": [

tests/summarycode/data/plugin_consolidate/package-files-not-counted-in-license-holders-expected.json

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,4 @@
11
{
2-
"headers": [
3-
{
4-
"tool_name": "scancode-toolkit",
5-
"options": {
6-
"input": "<path>",
7-
"--consolidate": true,
8-
"--copyright": true,
9-
"--info": true,
10-
"--json": "<file>",
11-
"--license": true,
12-
"--package": true
13-
},
14-
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
15-
"output_format_version": "2.0.0",
16-
"message": null,
17-
"errors": [],
18-
"warnings": [
19-
"The --consolidate option will be deprecated in a future version of scancode-toolkit."
20-
],
21-
"extra_data": {
22-
"system_environment": {
23-
"operating_system": "linux",
24-
"cpu_architecture": "64",
25-
"platform": "Linux-5.4.0-109-generic-x86_64-with-Ubuntu-18.04-bionic",
26-
"platform_version": "#123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022",
27-
"python_version": "3.6.9 (default, Mar 15 2022, 13:55:28) \n[GCC 8.4.0]"
28-
},
29-
"spdx_license_list_version": "3.16",
30-
"files_count": 6
31-
}
32-
}
33-
],
342
"dependencies": [],
353
"packages": [
364
{

0 commit comments

Comments
 (0)