Skip to content

Commit

Permalink
feat(model): Sort the detected license mapping during serialization
Browse files Browse the repository at this point in the history
Sort `ScannerConfiguration.detectedLicenseMapping` during serialization
to have a stable order in ORT result files. This helps when comparing
ORT result files from different sources.

Signed-off-by: Martin Nonnenmacher <[email protected]>
  • Loading branch information
mnonnenmacher authored and fviernau committed Nov 22, 2023
1 parent caedab1 commit 623b2fa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions model/src/main/kotlin/config/ScannerConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package org.ossreviewtoolkit.model.config

import com.fasterxml.jackson.annotation.JsonAlias
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.annotation.JsonPropertyOrder

import org.ossreviewtoolkit.model.utils.FileArchiver
import org.ossreviewtoolkit.utils.ort.ORT_REPO_CONFIG_FILENAME
Expand Down Expand Up @@ -52,6 +53,7 @@ data class ScannerConfiguration(
* Mappings from licenses returned by the scanner to valid SPDX licenses. Note that these mappings are only applied
* in new scans, stored scan results are not affected.
*/
@JsonPropertyOrder(alphabetic = true)
val detectedLicenseMapping: Map<String, String> = mapOf(
// https://scancode-licensedb.aboutcode.org/?search=generic
"LicenseRef-scancode-agpl-generic-additional-terms" to SpdxConstants.NOASSERTION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,20 +197,20 @@ scanner:
create_missing_archives: false
detected_license_mapping:
LicenseRef-scancode-agpl-generic-additional-terms: "NOASSERTION"
LicenseRef-scancode-free-unknown: "NOASSERTION"
LicenseRef-scancode-generic-cla: "NOASSERTION"
LicenseRef-scancode-generic-exception: "NOASSERTION"
LicenseRef-scancode-generic-export-compliance: "NOASSERTION"
LicenseRef-scancode-generic-tos: "NOASSERTION"
LicenseRef-scancode-generic-trademark: "NOASSERTION"
LicenseRef-scancode-gpl-generic-additional-terms: "NOASSERTION"
LicenseRef-scancode-patent-disclaimer: "NOASSERTION"
LicenseRef-scancode-warranty-disclaimer: "NOASSERTION"
LicenseRef-scancode-other-copyleft: "NOASSERTION"
LicenseRef-scancode-other-permissive: "NOASSERTION"
LicenseRef-scancode-free-unknown: "NOASSERTION"
LicenseRef-scancode-patent-disclaimer: "NOASSERTION"
LicenseRef-scancode-unknown: "NOASSERTION"
LicenseRef-scancode-unknown-license-reference: "NOASSERTION"
LicenseRef-scancode-unknown-spdx: "NOASSERTION"
LicenseRef-scancode-warranty-disclaimer: "NOASSERTION"
ignore_patterns:
- "**/*.ort.yml"
- "**/*.spdx.yml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ scanner:
create_missing_archives: false
detected_license_mapping:
LicenseRef-scancode-agpl-generic-additional-terms: "NOASSERTION"
LicenseRef-scancode-free-unknown: "NOASSERTION"
LicenseRef-scancode-generic-cla: "NOASSERTION"
LicenseRef-scancode-generic-exception: "NOASSERTION"
LicenseRef-scancode-generic-export-compliance: "NOASSERTION"
LicenseRef-scancode-generic-tos: "NOASSERTION"
LicenseRef-scancode-generic-trademark: "NOASSERTION"
LicenseRef-scancode-gpl-generic-additional-terms: "NOASSERTION"
LicenseRef-scancode-patent-disclaimer: "NOASSERTION"
LicenseRef-scancode-warranty-disclaimer: "NOASSERTION"
LicenseRef-scancode-other-copyleft: "NOASSERTION"
LicenseRef-scancode-other-permissive: "NOASSERTION"
LicenseRef-scancode-free-unknown: "NOASSERTION"
LicenseRef-scancode-patent-disclaimer: "NOASSERTION"
LicenseRef-scancode-unknown: "NOASSERTION"
LicenseRef-scancode-unknown-license-reference: "NOASSERTION"
LicenseRef-scancode-unknown-spdx: "NOASSERTION"
LicenseRef-scancode-warranty-disclaimer: "NOASSERTION"
ignore_patterns:
- "**/*.ort.yml"
- "**/*.spdx.yml"
Expand Down

0 comments on commit 623b2fa

Please sign in to comment.