From e8b3826ba56ace25436b98524bbc4ae66a48bef3 Mon Sep 17 00:00:00 2001 From: Agustin Isasmendi Date: Tue, 23 Jan 2024 15:49:20 +0100 Subject: [PATCH] SCP-55 Adds extra info into licenses output --- src/services/result.interfaces.ts | 1 + src/services/result.service.ts | 40 +++++++++++++++++++++++-------- src/services/result.test.ts | 36 ++++++++++++++++++---------- 3 files changed, 54 insertions(+), 23 deletions(-) diff --git a/src/services/result.interfaces.ts b/src/services/result.interfaces.ts index 5c7444c..32aa595 100644 --- a/src/services/result.interfaces.ts +++ b/src/services/result.interfaces.ts @@ -49,6 +49,7 @@ export interface ScannerComponent extends CommonComponent { osadl_updated: string source: string incompatible_with?: string + url: string }[] dependencies: { vendor: string diff --git a/src/services/result.service.ts b/src/services/result.service.ts index 13294ac..53aed68 100644 --- a/src/services/result.service.ts +++ b/src/services/result.service.ts @@ -6,27 +6,47 @@ export async function readResult(filepath: string): Promise { return JSON.parse(content) as ScannerResults } -export function getLicenses(results: ScannerResults): string[] { - const licenses = new Set() +export interface Licenses { + spdxid: string + copyleft: boolean | null + url: string | null +} + +export function getLicenses(results: ScannerResults): Licenses[] { + const licenses = new Array() for (const component of Object.values(results)) { for (const c of component) { + if (c.id === ComponentID.FILE || c.id === ComponentID.SNIPPET) { + for (const l of (c as ScannerComponent).licenses) { + licenses.push({ + spdxid: l.name, + copyleft: !l.copyleft ? null : l.copyleft === 'yes' ? true : false, + url: l?.url ? l.url : null + }) + } + } + if (c.id === ComponentID.DEPENDENCY) { const dependencies = (c as DependencyComponent).dependencies for (const d of dependencies) { for (const l of d.licenses) { - licenses.add(l.spdx_id) + if (!l.spdx_id) continue + licenses.push({ spdxid: l.spdx_id, copyleft: null, url: null }) } } } - - if (c.id === ComponentID.FILE || c.id === ComponentID.SNIPPET) { - for (const l of (c as ScannerComponent).licenses) { - licenses.add(l.name) - } - } } } - return Array.from(licenses) + const seenSpdxIds = new Set() + const uniqueLicenses = licenses.filter(license => { + if (!seenSpdxIds.has(license.spdxid)) { + seenSpdxIds.add(license.spdxid) + return true + } + return false + }) + + return uniqueLicenses } diff --git a/src/services/result.test.ts b/src/services/result.test.ts index af3227b..78ce3a9 100644 --- a/src/services/result.test.ts +++ b/src/services/result.test.ts @@ -1,27 +1,36 @@ import { ScannerResults } from './result.interfaces' -import { getLicenses } from './result.service' +import { getLicenses, Licenses } from './result.service' -const licenseTableTest = [ +const licenseTableTest: { name: string; description: string; content: string; licenses: Licenses[] }[] = [ { name: '1) license test', description: 'Only one dependency file', content: '{"package.json":[{"dependencies":[{"component":"p-timeout","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:npm/p-timeout","url":"https://www.npmjs.com/package/p-timeout","version":"6.1.2"},{"component":"@sindresorhus/tsconfig","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:npm/%40sindresorhus/tsconfig","url":"https://www.npmjs.com/package/%40sindresorhus/tsconfig","version":"5.0.0"}],"id":"dependency","status":"pending"}]}', - licenses: ['MIT'] + licenses: [{ spdxid: 'MIT', url: null, copyleft: null }] }, { name: '2) license test', description: 'Only dependencies files', content: '{"package.json":[{"dependencies":[{"component":"@types/node","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:npm/%40types/node","url":"https://www.npmjs.com/package/%40types/node","version":"17.0.45"},{"component":"packageurl-js","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:npm/packageurl-js","url":"https://www.npmjs.com/package/packageurl-js","version":"0.0.5"},{"component":"typescript","licenses":[{"is_spdx_approved":true,"name":"Apache-2.0","spdx_id":"Apache-2.0"}],"purl":"pkg:npm/typescript","url":"https://www.npmjs.com/package/typescript","version":"4.9.5"}],"id":"dependency","status":"pending"}],"requirements.txt":[{"dependencies":[{"component":"requests","licenses":[{"is_spdx_approved":true,"name":"Apache2.0","spdx_id":"Apache-2.0"}],"purl":"pkg:pypi/requests","url":"https://pypi.org/project/requests","version":"2.31.0"},{"licenses":[{}],"purl":"pkg:pypi/crc32c"},{"component":"binaryornot","licenses":[{"is_spdx_approved":true,"name":"BSD","spdx_id":"0BSD"}],"purl":"pkg:pypi/binaryornot","url":"https://pypi.org/project/binaryornot","version":"0.4.4"},{"component":"pytest","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:pypi/pytest","url":"https://pypi.org/project/pytest","version":"8.0.0rc2"},{"component":"pytest-cov","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:pypi/pytest-cov","url":"https://pypi.org/project/pytest-cov","version":"4.1.0"},{"component":"beautifulsoup4","licenses":[{"is_spdx_approved":true,"name":"MITLicense","spdx_id":"MIT"}],"purl":"pkg:pypi/beautifulsoup4","url":"https://pypi.org/project/beautifulsoup4","version":"4.12.3"}],"id":"dependency","status":"pending"}]}', - licenses: ['MIT', 'Apache-2.0', '0BSD'] + licenses: [ + { spdxid: 'MIT', url: null, copyleft: null }, + { spdxid: 'Apache-2.0', url: null, copyleft: null }, + { spdxid: '0BSD', url: null, copyleft: null } + ] }, { name: '3) license test', description: 'Scan without dependencies. It includes components with id:none, id:snippet and id:file', content: '{"aaaaa.c":[{"component":"engine","file":"cryptography.c","file_hash":"45931442719d401103ab8bcbbca1af99","file_url":"https://osskb.org/api/file_contents/45931442719d401103ab8bcbbca1af99","id":"snippet","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"1-37","matched":"97%","oss_lines":"33-69","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"aefc7383cccb35ecf8994c49d17c69be","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"attributions.c":[{"component":"engine","file":"attributions.c","file_hash":"4dd9a878731a51b612fedde5ad5d6084","file_url":"https://osskb.org/api/file_contents/4dd9a878731a51b612fedde5ad5d6084","id":"file","latest":"5.3.4","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"name":"JSON","source":"scancode","url":"https://spdx.org/licenses/JSON.html"},{"name":"LicenseRef-scancode-unknown-license-reference","source":"scancode"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"4dd9a878731a51b612fedde5ad5d6084","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"binary_scan.c":[{"component":"engine","file":"binary_scan.c","file_hash":"0d27d55d1134cbdaa1536babdff219f5","file_url":"https://osskb.org/api/file_contents/0d27d55d1134cbdaa1536babdff219f5","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"0d27d55d1134cbdaa1536babdff219f5","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"component.c":[{"component":"engine","file":"component.c","file_hash":"6852eb3bc69f70a15064645ad24446a2","file_url":"https://osskb.org/api/file_contents/6852eb3bc69f70a15064645ad24446a2","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2023-06-05","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"6852eb3bc69f70a15064645ad24446a2","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"1170a6175564e85c6877886e5ca565b2","vendor":"scanoss","version":"5.2.6"}],"copyright.c":[{"component":"engine","file":"copyright.c","file_hash":"e5965a5937743a78129b73b4171961e9","file_url":"https://osskb.org/api/file_contents/e5965a5937743a78129b73b4171961e9","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"e5965a5937743a78129b73b4171961e9","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"cryptography.c":[{"component":"engine","file":"cryptography.c","file_hash":"45931442719d401103ab8bcbbca1af99","file_url":"https://osskb.org/api/file_contents/45931442719d401103ab8bcbbca1af99","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"45931442719d401103ab8bcbbca1af99","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"debug.c":[{"component":"engine","file":"debug.c","file_hash":"5adbcacf687f26596731900c07570673","file_url":"https://osskb.org/api/file_contents/5adbcacf687f26596731900c07570673","id":"file","latest":"5.3.4","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"5adbcacf687f26596731900c07570673","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"decrypt.c":[{"component":"engine","file":"decrypt.c","file_hash":"d954b45c05e338f1a9f56a93110cdae0","file_url":"https://osskb.org/api/file_contents/d954b45c05e338f1a9f56a93110cdae0","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"d954b45c05e338f1a9f56a93110cdae0","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"no-match.c":[{"id":"none","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"}}]}', - licenses: ['GPL-2.0-only', 'JSON', 'LicenseRef-scancode-unknown-license-reference', 'GPL-2.0-or-later'] + licenses: [ + { spdxid: 'GPL-2.0-only', url: 'https://spdx.org/licenses/GPL-2.0-only.html', copyleft: true }, + { spdxid: 'GPL-2.0-or-later', url: 'https://spdx.org/licenses/GPL-2.0-or-later.html', copyleft: true }, + { spdxid: 'JSON', url: 'https://spdx.org/licenses/JSON.html', copyleft: null }, + { spdxid: 'LicenseRef-scancode-unknown-license-reference', url: null, copyleft: null } + ] }, { name: '4) license test', @@ -29,13 +38,13 @@ const licenseTableTest = [ content: '{"aaaaa.c":[{"component":"engine","file":"cryptography.c","file_hash":"45931442719d401103ab8bcbbca1af99","file_url":"https://osskb.org/api/file_contents/45931442719d401103ab8bcbbca1af99","id":"snippet","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"1-37","matched":"97%","oss_lines":"33-69","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"aefc7383cccb35ecf8994c49d17c69be","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"attributions.c":[{"component":"engine","file":"attributions.c","file_hash":"4dd9a878731a51b612fedde5ad5d6084","file_url":"https://osskb.org/api/file_contents/4dd9a878731a51b612fedde5ad5d6084","id":"file","latest":"5.3.4","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"name":"JSON","source":"scancode","url":"https://spdx.org/licenses/JSON.html"},{"name":"LicenseRef-scancode-unknown-license-reference","source":"scancode"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"4dd9a878731a51b612fedde5ad5d6084","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"binary_scan.c":[{"component":"engine","file":"binary_scan.c","file_hash":"0d27d55d1134cbdaa1536babdff219f5","file_url":"https://osskb.org/api/file_contents/0d27d55d1134cbdaa1536babdff219f5","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"0d27d55d1134cbdaa1536babdff219f5","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"component.c":[{"component":"engine","file":"component.c","file_hash":"6852eb3bc69f70a15064645ad24446a2","file_url":"https://osskb.org/api/file_contents/6852eb3bc69f70a15064645ad24446a2","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2023-06-05","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"6852eb3bc69f70a15064645ad24446a2","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"1170a6175564e85c6877886e5ca565b2","vendor":"scanoss","version":"5.2.6"}],"copyright.c":[{"component":"engine","file":"copyright.c","file_hash":"e5965a5937743a78129b73b4171961e9","file_url":"https://osskb.org/api/file_contents/e5965a5937743a78129b73b4171961e9","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"e5965a5937743a78129b73b4171961e9","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"cryptography.c":[{"component":"engine","file":"cryptography.c","file_hash":"45931442719d401103ab8bcbbca1af99","file_url":"https://osskb.org/api/file_contents/45931442719d401103ab8bcbbca1af99","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"45931442719d401103ab8bcbbca1af99","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"debug.c":[{"component":"engine","file":"debug.c","file_hash":"5adbcacf687f26596731900c07570673","file_url":"https://osskb.org/api/file_contents/5adbcacf687f26596731900c07570673","id":"file","latest":"5.3.4","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"scancode","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-12-29","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"5adbcacf687f26596731900c07570673","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"587fc14ceb8fdd57727a2ab98d707916","vendor":"scanoss","version":"5.1.1"}],"decrypt.c":[{"component":"engine","file":"decrypt.c","file_hash":"d954b45c05e338f1a9f56a93110cdae0","file_url":"https://osskb.org/api/file_contents/d954b45c05e338f1a9f56a93110cdae0","id":"file","latest":"5.3.5","licenses":[{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"component_declared","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-or-later.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-or-later","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"file_spdx_tag","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"checklist_url":"https://www.osadl.org/fileadmin/checklists/unreflicenses/GPL-2.0-only.txt","copyleft":"yes","incompatible_with":"Apache-1.0,Apache-1.1,Apache-2.0,BSD-4-Clause,BSD-4-Clause-UC,FTL,IJG,OpenSSL,Python-2.0,zlib-acknowledgement,XFree86-1.1","name":"GPL-2.0-only","osadl_updated":"2024-01-21T05:27:00+00:00","patent_hints":"yes","source":"license_file","url":"https://spdx.org/licenses/GPL-2.0-only.html"}],"lines":"all","matched":"100%","oss_lines":"all","purl":["pkg:github/scanoss/engine"],"release_date":"2022-09-26","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"},"source_hash":"d954b45c05e338f1a9f56a93110cdae0","status":"pending","url":"https://github.com/scanoss/engine","url_hash":"d6492e2364b3b7793773edf28a372c75","vendor":"scanoss","version":"5.0.0"}],"no-match.c":[{"id":"none","server":{"kb_version":{"daily":"24.01.22","monthly":"23.12"},"version":"5.3.5"}}],"requirements.txt":[{"dependencies":[{"component":"requests","licenses":[{"is_spdx_approved":true,"name":"Apache2.0","spdx_id":"Apache-2.0"}],"purl":"pkg:pypi/requests","url":"https://pypi.org/project/requests","version":"2.31.0"},{"licenses":[{}],"purl":"pkg:pypi/crc32c"},{"component":"binaryornot","licenses":[{"is_spdx_approved":true,"name":"BSD","spdx_id":"0BSD"}],"purl":"pkg:pypi/binaryornot","url":"https://pypi.org/project/binaryornot","version":"0.4.4"},{"component":"pytest","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:pypi/pytest","url":"https://pypi.org/project/pytest","version":"8.0.0rc2"},{"component":"pytest-cov","licenses":[{"is_spdx_approved":true,"name":"MIT","spdx_id":"MIT"}],"purl":"pkg:pypi/pytest-cov","url":"https://pypi.org/project/pytest-cov","version":"4.1.0"},{"component":"beautifulsoup4","licenses":[{"is_spdx_approved":true,"name":"MITLicense","spdx_id":"MIT"}],"purl":"pkg:pypi/beautifulsoup4","url":"https://pypi.org/project/beautifulsoup4","version":"4.12.3"}],"id":"dependency","status":"pending"}]}', licenses: [ - 'MIT', - 'GPL-2.0-only', - 'JSON', - 'LicenseRef-scancode-unknown-license-reference', - 'GPL-2.0-or-later', - 'Apache-2.0', - '0BSD' + { spdxid: 'MIT', url: null, copyleft: null }, + { spdxid: 'GPL-2.0-only', url: 'https://spdx.org/licenses/GPL-2.0-only.html', copyleft: true }, + { spdxid: 'JSON', url: 'https://spdx.org/licenses/JSON.html', copyleft: null }, + { spdxid: 'LicenseRef-scancode-unknown-license-reference', url: null, copyleft: null }, + { spdxid: 'GPL-2.0-or-later', url: 'https://spdx.org/licenses/GPL-2.0-or-later.html', copyleft: true }, + { spdxid: 'Apache-2.0', url: null, copyleft: null }, + { spdxid: '0BSD', url: null, copyleft: null } ] } ] @@ -46,7 +55,8 @@ describe('Test Results service', () => { const scannerResults = JSON.parse(t.content) as ScannerResults const licenses = getLicenses(scannerResults) - expect(licenses.sort()).toEqual(t.licenses.sort()) + const sortFn = (a: Licenses, b: Licenses) => a.spdxid.localeCompare(b.spdxid) + expect(licenses.sort(sortFn)).toEqual(t.licenses.sort(sortFn)) }) } })