Skip to content

Commit ce19d7a

Browse files
Add LicenseDetection full scan tests
Adds tests for: - unknown license intros - unknown local license references Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
1 parent 5b0dc11 commit ce19d7a

File tree

6 files changed

+1902
-328
lines changed

6 files changed

+1902
-328
lines changed

tests/licensedcode/data/plugin_license/license-expression/scan.expected.json

Lines changed: 176 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,62 @@
11
{
2-
"headers": [
3-
{
4-
"tool_name": "scancode-toolkit",
5-
"options": {
6-
"input": "<path>",
7-
"--json": "<file>",
8-
"--license": true,
9-
"--strip-root": true
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": 2
26-
}
27-
}
28-
],
292
"files": [
303
{
314
"path": "apache-1.0.txt",
325
"type": "file",
336
"licenses": [
347
{
35-
"key": "apache-1.0",
36-
"score": 100.0,
37-
"name": "Apache License 1.0",
38-
"short_name": "Apache 1.0",
39-
"category": "Permissive",
40-
"is_exception": false,
41-
"is_unknown": false,
42-
"owner": "Apache Software Foundation",
43-
"homepage_url": "http://www.apache.org/licenses/",
44-
"text_url": "http://www.apache.org/licenses/LICENSE-1.0",
45-
"reference_url": "https://scancode-licensedb.aboutcode.org/apache-1.0",
46-
"scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/apache-1.0.LICENSE",
47-
"scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/apache-1.0.yml",
48-
"spdx_license_key": "Apache-1.0",
49-
"spdx_url": "https://spdx.org/licenses/Apache-1.0",
50-
"start_line": 4,
51-
"end_line": 54,
52-
"matched_rule": {
53-
"identifier": "apache-1.0.LICENSE",
54-
"license_expression": "apache-1.0",
55-
"licenses": [
56-
"apache-1.0"
57-
],
58-
"referenced_filenames": [],
59-
"is_license_text": true,
60-
"is_license_notice": false,
61-
"is_license_reference": false,
62-
"is_license_tag": false,
63-
"is_license_intro": false,
64-
"has_unknown": false,
65-
"matcher": "2-aho",
66-
"rule_length": 368,
67-
"matched_length": 368,
68-
"match_coverage": 100.0,
69-
"rule_relevance": 100
70-
}
8+
"license_expression": "apache-1.0",
9+
"spdx_license_expression": "None",
10+
"combination_reasons": [],
11+
"matches": [
12+
{
13+
"key": "apache-1.0",
14+
"score": 100.0,
15+
"name": "Apache License 1.0",
16+
"short_name": "Apache 1.0",
17+
"category": "Permissive",
18+
"is_exception": false,
19+
"is_unknown": false,
20+
"owner": "Apache Software Foundation",
21+
"homepage_url": "http://www.apache.org/licenses/",
22+
"text_url": "http://www.apache.org/licenses/LICENSE-1.0",
23+
"reference_url": "https://scancode-licensedb.aboutcode.org/apache-1.0",
24+
"scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/apache-1.0.LICENSE",
25+
"scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/apache-1.0.yml",
26+
"spdx_license_key": "Apache-1.0",
27+
"spdx_url": "https://spdx.org/licenses/Apache-1.0",
28+
"start_line": 4,
29+
"end_line": 54,
30+
"matched_rule": {
31+
"identifier": "apache-1.0.LICENSE",
32+
"license_expression": "apache-1.0",
33+
"licenses": [
34+
"apache-1.0"
35+
],
36+
"referenced_filenames": [],
37+
"is_license_text": true,
38+
"is_license_notice": false,
39+
"is_license_reference": false,
40+
"is_license_tag": false,
41+
"is_license_intro": false,
42+
"has_unknown": false,
43+
"matcher": "2-aho",
44+
"rule_length": 368,
45+
"matched_length": 368,
46+
"match_coverage": 100.0,
47+
"rule_relevance": 100
48+
}
49+
}
50+
]
7151
}
7252
],
53+
"license_clues": [],
7354
"license_expressions": [
7455
"apache-1.0"
7556
],
57+
"spdx_license_expressions": [
58+
"None"
59+
],
7660
"percentage_of_license_text": 97.61,
7761
"scan_errors": []
7862
},
@@ -81,129 +65,140 @@
8165
"type": "file",
8266
"licenses": [
8367
{
84-
"key": "gpl-2.0",
85-
"score": 100.0,
86-
"name": "GNU General Public License 2.0",
87-
"short_name": "GPL 2.0",
88-
"category": "Copyleft",
89-
"is_exception": false,
90-
"is_unknown": false,
91-
"owner": "Free Software Foundation (FSF)",
92-
"homepage_url": "http://www.gnu.org/licenses/gpl-2.0.html",
93-
"text_url": "http://www.gnu.org/licenses/gpl-2.0.txt",
94-
"reference_url": "https://scancode-licensedb.aboutcode.org/gpl-2.0",
95-
"scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.LICENSE",
96-
"scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.yml",
97-
"spdx_license_key": "GPL-2.0-only",
98-
"spdx_url": "https://spdx.org/licenses/GPL-2.0-only",
99-
"start_line": 1,
100-
"end_line": 1,
101-
"matched_rule": {
102-
"identifier": "spdx-license-identifier: gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
103-
"license_expression": "gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
104-
"licenses": [
105-
"gpl-2.0",
106-
"linux-syscall-exception-gpl",
107-
"linux-openib"
108-
],
109-
"referenced_filenames": [],
110-
"is_license_text": false,
111-
"is_license_notice": false,
112-
"is_license_reference": false,
113-
"is_license_tag": true,
114-
"is_license_intro": false,
115-
"has_unknown": false,
116-
"matcher": "1-spdx-id",
117-
"rule_length": 13,
118-
"matched_length": 13,
119-
"match_coverage": 100.0,
120-
"rule_relevance": 100
121-
}
122-
},
123-
{
124-
"key": "linux-syscall-exception-gpl",
125-
"score": 100.0,
126-
"name": "Linux Syscall Exception to GPL",
127-
"short_name": "Linux Syscall Exception to GPL",
128-
"category": "Copyleft Limited",
129-
"is_exception": true,
130-
"is_unknown": false,
131-
"owner": "Linux Foundation",
132-
"homepage_url": null,
133-
"text_url": "",
134-
"reference_url": "https://scancode-licensedb.aboutcode.org/linux-syscall-exception-gpl",
135-
"scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/linux-syscall-exception-gpl.LICENSE",
136-
"scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/linux-syscall-exception-gpl.yml",
137-
"spdx_license_key": "Linux-syscall-note",
138-
"spdx_url": "https://spdx.org/licenses/Linux-syscall-note",
139-
"start_line": 1,
140-
"end_line": 1,
141-
"matched_rule": {
142-
"identifier": "spdx-license-identifier: gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
143-
"license_expression": "gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
144-
"licenses": [
145-
"gpl-2.0",
146-
"linux-syscall-exception-gpl",
147-
"linux-openib"
148-
],
149-
"referenced_filenames": [],
150-
"is_license_text": false,
151-
"is_license_notice": false,
152-
"is_license_reference": false,
153-
"is_license_tag": true,
154-
"is_license_intro": false,
155-
"has_unknown": false,
156-
"matcher": "1-spdx-id",
157-
"rule_length": 13,
158-
"matched_length": 13,
159-
"match_coverage": 100.0,
160-
"rule_relevance": 100
161-
}
162-
},
163-
{
164-
"key": "linux-openib",
165-
"score": 100.0,
166-
"name": "Linux-OpenIB",
167-
"short_name": "Linux-OpenIB",
168-
"category": "Permissive",
169-
"is_exception": false,
170-
"is_unknown": false,
171-
"owner": "Linux Foundation",
172-
"homepage_url": "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/infiniband/core/sa.h",
173-
"text_url": "https://github.com/ofiwg/libfabric/blob/master/contrib/buildrpm/README",
174-
"reference_url": "https://scancode-licensedb.aboutcode.org/linux-openib",
175-
"scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/linux-openib.LICENSE",
176-
"scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/linux-openib.yml",
177-
"spdx_license_key": "Linux-OpenIB",
178-
"spdx_url": "https://spdx.org/licenses/Linux-OpenIB",
179-
"start_line": 1,
180-
"end_line": 1,
181-
"matched_rule": {
182-
"identifier": "spdx-license-identifier: gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
183-
"license_expression": "gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
184-
"licenses": [
185-
"gpl-2.0",
186-
"linux-syscall-exception-gpl",
187-
"linux-openib"
188-
],
189-
"referenced_filenames": [],
190-
"is_license_text": false,
191-
"is_license_notice": false,
192-
"is_license_reference": false,
193-
"is_license_tag": true,
194-
"is_license_intro": false,
195-
"has_unknown": false,
196-
"matcher": "1-spdx-id",
197-
"rule_length": 13,
198-
"matched_length": 13,
199-
"match_coverage": 100.0,
200-
"rule_relevance": 100
201-
}
68+
"license_expression": "gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
69+
"spdx_license_expression": "None",
70+
"combination_reasons": [],
71+
"matches": [
72+
{
73+
"key": "gpl-2.0",
74+
"score": 100.0,
75+
"name": "GNU General Public License 2.0",
76+
"short_name": "GPL 2.0",
77+
"category": "Copyleft",
78+
"is_exception": false,
79+
"is_unknown": false,
80+
"owner": "Free Software Foundation (FSF)",
81+
"homepage_url": "http://www.gnu.org/licenses/gpl-2.0.html",
82+
"text_url": "http://www.gnu.org/licenses/gpl-2.0.txt",
83+
"reference_url": "https://scancode-licensedb.aboutcode.org/gpl-2.0",
84+
"scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.LICENSE",
85+
"scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0.yml",
86+
"spdx_license_key": "GPL-2.0-only",
87+
"spdx_url": "https://spdx.org/licenses/GPL-2.0-only",
88+
"start_line": 1,
89+
"end_line": 1,
90+
"matched_rule": {
91+
"identifier": "spdx-license-identifier: gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
92+
"license_expression": "gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
93+
"licenses": [
94+
"gpl-2.0",
95+
"linux-syscall-exception-gpl",
96+
"linux-openib"
97+
],
98+
"referenced_filenames": [],
99+
"is_license_text": false,
100+
"is_license_notice": false,
101+
"is_license_reference": false,
102+
"is_license_tag": true,
103+
"is_license_intro": false,
104+
"has_unknown": false,
105+
"matcher": "1-spdx-id",
106+
"rule_length": 13,
107+
"matched_length": 13,
108+
"match_coverage": 100.0,
109+
"rule_relevance": 100
110+
}
111+
},
112+
{
113+
"key": "linux-syscall-exception-gpl",
114+
"score": 100.0,
115+
"name": "Linux Syscall Exception to GPL",
116+
"short_name": "Linux Syscall Exception to GPL",
117+
"category": "Copyleft Limited",
118+
"is_exception": true,
119+
"is_unknown": false,
120+
"owner": "Linux Foundation",
121+
"homepage_url": null,
122+
"text_url": "",
123+
"reference_url": "https://scancode-licensedb.aboutcode.org/linux-syscall-exception-gpl",
124+
"scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/linux-syscall-exception-gpl.LICENSE",
125+
"scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/linux-syscall-exception-gpl.yml",
126+
"spdx_license_key": "Linux-syscall-note",
127+
"spdx_url": "https://spdx.org/licenses/Linux-syscall-note",
128+
"start_line": 1,
129+
"end_line": 1,
130+
"matched_rule": {
131+
"identifier": "spdx-license-identifier: gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
132+
"license_expression": "gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
133+
"licenses": [
134+
"gpl-2.0",
135+
"linux-syscall-exception-gpl",
136+
"linux-openib"
137+
],
138+
"referenced_filenames": [],
139+
"is_license_text": false,
140+
"is_license_notice": false,
141+
"is_license_reference": false,
142+
"is_license_tag": true,
143+
"is_license_intro": false,
144+
"has_unknown": false,
145+
"matcher": "1-spdx-id",
146+
"rule_length": 13,
147+
"matched_length": 13,
148+
"match_coverage": 100.0,
149+
"rule_relevance": 100
150+
}
151+
},
152+
{
153+
"key": "linux-openib",
154+
"score": 100.0,
155+
"name": "Linux-OpenIB",
156+
"short_name": "Linux-OpenIB",
157+
"category": "Permissive",
158+
"is_exception": false,
159+
"is_unknown": false,
160+
"owner": "Linux Foundation",
161+
"homepage_url": "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/infiniband/core/sa.h",
162+
"text_url": "https://github.com/ofiwg/libfabric/blob/master/contrib/buildrpm/README",
163+
"reference_url": "https://scancode-licensedb.aboutcode.org/linux-openib",
164+
"scancode_text_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/linux-openib.LICENSE",
165+
"scancode_data_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/linux-openib.yml",
166+
"spdx_license_key": "Linux-OpenIB",
167+
"spdx_url": "https://spdx.org/licenses/Linux-OpenIB",
168+
"start_line": 1,
169+
"end_line": 1,
170+
"matched_rule": {
171+
"identifier": "spdx-license-identifier: gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
172+
"license_expression": "gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib",
173+
"licenses": [
174+
"gpl-2.0",
175+
"linux-syscall-exception-gpl",
176+
"linux-openib"
177+
],
178+
"referenced_filenames": [],
179+
"is_license_text": false,
180+
"is_license_notice": false,
181+
"is_license_reference": false,
182+
"is_license_tag": true,
183+
"is_license_intro": false,
184+
"has_unknown": false,
185+
"matcher": "1-spdx-id",
186+
"rule_length": 13,
187+
"matched_length": 13,
188+
"match_coverage": 100.0,
189+
"rule_relevance": 100
190+
}
191+
}
192+
]
202193
}
203194
],
195+
"license_clues": [],
204196
"license_expressions": [
205197
"gpl-2.0 WITH linux-syscall-exception-gpl OR linux-openib"
206198
],
199+
"spdx_license_expressions": [
200+
"None"
201+
],
207202
"percentage_of_license_text": 100.0,
208203
"scan_errors": []
209204
}

0 commit comments

Comments
 (0)