Skip to content

Commit

Permalink
fix(askalono): Correctly handle errors in results
Browse files Browse the repository at this point in the history
The result structure contains either a "result" or an "error" key.

Signed-off-by: Haiko Schol <[email protected]>
  • Loading branch information
haikoschol authored and sschuberth committed Feb 9, 2024
1 parent 4e3b23f commit a547091
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugins/scanners/askalono/src/main/kotlin/Askalono.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ class Askalono internal constructor(name: String, private val wrapperConfig: Sca
)

results.forEach {
if (it.error == null) {
if (it.result != null) {
licenseFindings += LicenseFinding(
license = it.result.license.name,
location = TextLocation(it.path, TextLocation.UNKNOWN_LINE),
score = it.result.score
)
} else {
} else if (it.error != null) {
issues += Issue(
source = name,
message = it.error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import kotlinx.serialization.Serializable
@Serializable
data class AskalonoResult(
val path: String,
val result: PathResult,
val result: PathResult? = null,
val error: String? = null
)

Expand Down

0 comments on commit a547091

Please sign in to comment.