File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -45,8 +45,6 @@ import org.ossreviewtoolkit.utils.common.Os
4545
4646private const val CONFIDENCE_NOTICE = " Confidence threshold not high enough for any known license"
4747
48- private val JSON = Json { ignoreUnknownKeys = true }
49-
5048object AskalonoCommand : CommandLineTool {
5149 override fun command (workingDir : File ? ) =
5250 listOfNotNull(workingDir, if (Os .isWindows) " askalono.exe" else " askalono" ).joinToString(File .separator)
@@ -107,7 +105,7 @@ class Askalono(
107105 }
108106
109107 override fun createSummary (result : String , startTime : Instant , endTime : Instant ): ScanSummary {
110- val results = result.byteInputStream().use { JSON .decodeToSequence<AskalonoResult >(it) }
108+ val results = result.byteInputStream().use { Json .decodeToSequence<AskalonoResult >(it) }
111109
112110 val licenseFindings = mutableSetOf<LicenseFinding >()
113111
Original file line number Diff line number Diff line change 2020package org.ossreviewtoolkit.plugins.scanners.askalono
2121
2222import kotlinx.serialization.Serializable
23+ import kotlinx.serialization.json.JsonIgnoreUnknownKeys
2324
25+ // See https://github.com/jpeddicord/askalono/blob/0.5.0/cli/src/formats.rs#L12-L23.
2426@Serializable
2527data class AskalonoResult (
2628 val path : String ,
2729 val result : PathResult ? = null ,
2830 val error : String? = null
2931)
3032
33+ // See https://github.com/jpeddicord/askalono/blob/0.5.0/cli/src/formats.rs#L25-L30.
3134@Serializable
35+ @JsonIgnoreUnknownKeys
3236data class PathResult (
3337 val score : Float ,
3438 val license : LicenseResult
3539)
3640
41+ // See https://github.com/jpeddicord/askalono/blob/0.5.0/cli/src/formats.rs#L32-L37.
3742@Serializable
43+ @JsonIgnoreUnknownKeys
3844data class LicenseResult (
3945 val name : String ,
4046 val aliases : Set <String >
Original file line number Diff line number Diff line change @@ -44,8 +44,6 @@ import org.ossreviewtoolkit.utils.common.Os
4444import org.ossreviewtoolkit.utils.common.safeDeleteRecursively
4545import org.ossreviewtoolkit.utils.ort.createOrtTempDir
4646
47- private val JSON = Json { ignoreUnknownKeys = true }
48-
4947object BoyterLcCommand : CommandLineTool {
5048 override fun command (workingDir : File ? ) =
5149 listOfNotNull(workingDir, if (Os .isWindows) " lc.exe" else " lc" ).joinToString(File .separator)
@@ -115,7 +113,7 @@ class BoyterLc(
115113 }
116114
117115 override fun createSummary (result : String , startTime : Instant , endTime : Instant ): ScanSummary {
118- val results = JSON .decodeFromString<List <BoyterLcResult >>(result)
116+ val results = Json .decodeFromString<List <BoyterLcResult >>(result)
119117
120118 val licenseFindings = results.flatMapTo(mutableSetOf ()) {
121119 val filePath = File (it.directory, it.filename)
Original file line number Diff line number Diff line change @@ -21,14 +21,18 @@ package org.ossreviewtoolkit.plugins.scanners.boyterlc
2121
2222import kotlinx.serialization.SerialName
2323import kotlinx.serialization.Serializable
24+ import kotlinx.serialization.json.JsonIgnoreUnknownKeys
2425
26+ // See https://github.com/boyter/lc/blob/7a7c5750857efde2f1d50b1c3b62c07943587421/parsers/structs.go#L20-L31.
2527@Serializable
28+ @JsonIgnoreUnknownKeys
2629class BoyterLcResult (
2730 @SerialName(" Directory" ) val directory : String ,
2831 @SerialName(" Filename" ) val filename : String ,
2932 @SerialName(" LicenseGuesses" ) val licenseGuesses : List <LicenseGuess >
3033)
3134
35+ // See https://github.com/boyter/lc/blob/v1.3.1/parsers/structs.go#L15-L18.
3236@Serializable
3337data class LicenseGuess (
3438 @SerialName(" LicenseId" ) val licenseId : String ,
You can’t perform that action at this time.
0 commit comments