Skip to content

Commit a018711

Browse files
authored
Enable --license-references option in scan_single_package pipeline #1657 (#1706)
Signed-off-by: tdruez <[email protected]>
1 parent 820d7a7 commit a018711

File tree

5 files changed

+362
-0
lines changed

5 files changed

+362
-0
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ v35.1.0 (unreleased)
1010
Requires the ``find_vulnerabilities`` pipeline to be executed beforehand.
1111
https://github.com/aboutcode-org/scancode.io/pull/1702
1212

13+
- Enable ``--license-references`` scan option in the ``scan_single_package`` pipeline.
14+
The ``license_references`` and ``license_rule_references`` attributes will now be
15+
available in the scan results, including the details about detected licenses and
16+
license rules used during the scan.
17+
https://github.com/aboutcode-org/scancode.io/issues/1657
18+
1319
v35.0.0 (2025-06-23)
1420
--------------------
1521

scanpipe/pipelines/scan_single_package.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def steps(cls):
6161
"info": True,
6262
"license": True,
6363
"license_text": True,
64+
"license_references": True,
6465
"package": True,
6566
"url": True,
6667
"classify": True,

scanpipe/tests/data/manifests/openpdf-parent-1.3.11_scan_package.json

Lines changed: 155 additions & 0 deletions
Large diffs are not rendered by default.

scanpipe/tests/data/scancode/is-npm-1.0.0_scan_package.json

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"--info": true,
99
"--license": true,
1010
"--license-text": true,
11+
"--license-references": true,
1112
"--package": true,
1213
"--url": true,
1314
"--classify": true,
@@ -206,6 +207,105 @@
206207
]
207208
}
208209
],
210+
"license_references": [
211+
{
212+
"key": "mit",
213+
"language": "en",
214+
"short_name": "MIT License",
215+
"name": "MIT License",
216+
"category": "Permissive",
217+
"owner": "MIT",
218+
"homepage_url": "http://opensource.org/licenses/mit-license.php",
219+
"is_builtin": true,
220+
"is_exception": false,
221+
"is_unknown": false,
222+
"is_generic": false,
223+
"spdx_license_key": "MIT",
224+
"other_spdx_license_keys": [
225+
"LicenseRef-MIT-Bootstrap",
226+
"LicenseRef-MIT-Discord",
227+
"LicenseRef-MIT-TC",
228+
"LicenseRef-MIT-Diehl"
229+
],
230+
"osi_license_key": null,
231+
"text_urls": [
232+
"http://opensource.org/licenses/mit-license.php"
233+
],
234+
"osi_url": "http://www.opensource.org/licenses/MIT",
235+
"faq_url": "https://ieeexplore.ieee.org/document/9263265",
236+
"other_urls": [
237+
"https://opensource.com/article/18/3/patent-grant-mit-license",
238+
"https://opensource.com/article/19/4/history-mit-license",
239+
"https://opensource.org/licenses/MIT"
240+
],
241+
"key_aliases": [],
242+
"minimum_coverage": 0,
243+
"standard_notice": null,
244+
"ignorable_copyrights": [],
245+
"ignorable_holders": [],
246+
"ignorable_authors": [],
247+
"ignorable_urls": [],
248+
"ignorable_emails": [],
249+
"text": "Permission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
250+
"scancode_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE",
251+
"licensedb_url": "https://scancode-licensedb.aboutcode.org/mit",
252+
"spdx_url": "https://spdx.org/licenses/MIT"
253+
}
254+
],
255+
"license_rule_references": [
256+
{
257+
"license_expression": "mit",
258+
"identifier": "mit_30.RULE",
259+
"language": "en",
260+
"rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE",
261+
"is_license_text": false,
262+
"is_license_notice": false,
263+
"is_license_reference": false,
264+
"is_license_tag": true,
265+
"is_license_intro": false,
266+
"is_license_clue": false,
267+
"is_continuous": false,
268+
"is_builtin": true,
269+
"is_from_license": false,
270+
"is_synthetic": false,
271+
"length": 2,
272+
"relevance": 100,
273+
"minimum_coverage": 100,
274+
"referenced_filenames": [],
275+
"ignorable_copyrights": [],
276+
"ignorable_holders": [],
277+
"ignorable_authors": [],
278+
"ignorable_urls": [],
279+
"ignorable_emails": [],
280+
"text": "License: MIT"
281+
},
282+
{
283+
"license_expression": "mit",
284+
"identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06",
285+
"language": "en",
286+
"rule_url": null,
287+
"is_license_text": false,
288+
"is_license_notice": false,
289+
"is_license_reference": false,
290+
"is_license_tag": true,
291+
"is_license_intro": false,
292+
"is_license_clue": false,
293+
"is_continuous": false,
294+
"is_builtin": true,
295+
"is_from_license": false,
296+
"is_synthetic": true,
297+
"length": 1,
298+
"relevance": 100,
299+
"minimum_coverage": 0,
300+
"referenced_filenames": [],
301+
"ignorable_copyrights": [],
302+
"ignorable_holders": [],
303+
"ignorable_authors": [],
304+
"ignorable_urls": [],
305+
"ignorable_emails": [],
306+
"text": "MIT"
307+
}
308+
],
209309
"files": [
210310
{
211311
"path": "codebase",

scanpipe/tests/data/scancode/multiple-is-npm-1.0.0_scan_package.json

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"--info": true,
99
"--license": true,
1010
"--license-text": true,
11+
"--license-references": true,
1112
"--package": true,
1213
"--url": true,
1314
"--classify": true,
@@ -309,6 +310,105 @@
309310
]
310311
}
311312
],
313+
"license_references": [
314+
{
315+
"key": "mit",
316+
"language": "en",
317+
"short_name": "MIT License",
318+
"name": "MIT License",
319+
"category": "Permissive",
320+
"owner": "MIT",
321+
"homepage_url": "http://opensource.org/licenses/mit-license.php",
322+
"is_builtin": true,
323+
"is_exception": false,
324+
"is_unknown": false,
325+
"is_generic": false,
326+
"spdx_license_key": "MIT",
327+
"other_spdx_license_keys": [
328+
"LicenseRef-MIT-Bootstrap",
329+
"LicenseRef-MIT-Discord",
330+
"LicenseRef-MIT-TC",
331+
"LicenseRef-MIT-Diehl"
332+
],
333+
"osi_license_key": null,
334+
"text_urls": [
335+
"http://opensource.org/licenses/mit-license.php"
336+
],
337+
"osi_url": "http://www.opensource.org/licenses/MIT",
338+
"faq_url": "https://ieeexplore.ieee.org/document/9263265",
339+
"other_urls": [
340+
"https://opensource.com/article/18/3/patent-grant-mit-license",
341+
"https://opensource.com/article/19/4/history-mit-license",
342+
"https://opensource.org/licenses/MIT"
343+
],
344+
"key_aliases": [],
345+
"minimum_coverage": 0,
346+
"standard_notice": null,
347+
"ignorable_copyrights": [],
348+
"ignorable_holders": [],
349+
"ignorable_authors": [],
350+
"ignorable_urls": [],
351+
"ignorable_emails": [],
352+
"text": "Permission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
353+
"scancode_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE",
354+
"licensedb_url": "https://scancode-licensedb.aboutcode.org/mit",
355+
"spdx_url": "https://spdx.org/licenses/MIT"
356+
}
357+
],
358+
"license_rule_references": [
359+
{
360+
"license_expression": "mit",
361+
"identifier": "mit_30.RULE",
362+
"language": "en",
363+
"rule_url": "https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/rules/mit_30.RULE",
364+
"is_license_text": false,
365+
"is_license_notice": false,
366+
"is_license_reference": false,
367+
"is_license_tag": true,
368+
"is_license_intro": false,
369+
"is_license_clue": false,
370+
"is_continuous": false,
371+
"is_builtin": true,
372+
"is_from_license": false,
373+
"is_synthetic": false,
374+
"length": 2,
375+
"relevance": 100,
376+
"minimum_coverage": 100,
377+
"referenced_filenames": [],
378+
"ignorable_copyrights": [],
379+
"ignorable_holders": [],
380+
"ignorable_authors": [],
381+
"ignorable_urls": [],
382+
"ignorable_emails": [],
383+
"text": "License: MIT"
384+
},
385+
{
386+
"license_expression": "mit",
387+
"identifier": "spdx-license-identifier-mit-5da48780aba670b0860c46d899ed42a0f243ff06",
388+
"language": "en",
389+
"rule_url": null,
390+
"is_license_text": false,
391+
"is_license_notice": false,
392+
"is_license_reference": false,
393+
"is_license_tag": true,
394+
"is_license_intro": false,
395+
"is_license_clue": false,
396+
"is_continuous": false,
397+
"is_builtin": true,
398+
"is_from_license": false,
399+
"is_synthetic": true,
400+
"length": 1,
401+
"relevance": 100,
402+
"minimum_coverage": 0,
403+
"referenced_filenames": [],
404+
"ignorable_copyrights": [],
405+
"ignorable_holders": [],
406+
"ignorable_authors": [],
407+
"ignorable_urls": [],
408+
"ignorable_emails": [],
409+
"text": "MIT"
410+
}
411+
],
312412
"files": [
313413
{
314414
"path": "codebase",

0 commit comments

Comments
 (0)