Skip to content

Commit 24588cf

Browse files
nnobelisMarcelBochtler
authored andcommitted
fix(fossid-webapp): Set unmappable snippet license issue severity to HINT
With the introduction of snippet findings in the scan results, some issues are also present in the result because licenses from FossID snippets cannot always be mapped to SPDX, for instance "RETURNN license" or "Apache 2-0". While the usage of the declared license mapping file helped to alleviate some of these issues, several remained, polluting the webapp report. Opening a support ticket at FossID to have them correct the license, while being the correct solution, does not scale regarding the amount of licenses to correct. Therefore, this commit lowers for now the severity of these issues to `HINT` and map them to `NO_ASSERTION`. This is a temporary solution until a snippet curation mechanism is introduced to be able to correct those licenses. Signed-off-by: Nicolas Nobelis <[email protected]>
1 parent e3763e1 commit 24588cf

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

scanner/src/main/kotlin/scanners/fossid/FossIdScanResults.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import org.ossreviewtoolkit.model.Issue
3333
import org.ossreviewtoolkit.model.LicenseFinding
3434
import org.ossreviewtoolkit.model.PackageProvider
3535
import org.ossreviewtoolkit.model.RemoteArtifact
36+
import org.ossreviewtoolkit.model.Severity
3637
import org.ossreviewtoolkit.model.Snippet as OrtSnippet
3738
import org.ossreviewtoolkit.model.SnippetFinding
3839
import org.ossreviewtoolkit.model.TextLocation
@@ -124,7 +125,8 @@ internal fun mapSnippetFindings(
124125
if (expression == null) {
125126
issues += FossId.createAndLogIssue(
126127
source = "FossId",
127-
message = "Failed to map license '$it' as an SPDX expression."
128+
message = "Failed to map license '$it' as an SPDX expression.",
129+
severity = Severity.HINT
128130
)
129131
}
130132
}

scanner/src/test/kotlin/scanners/fossid/FossIdLicenseMappingTest.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import org.ossreviewtoolkit.clients.fossid.model.result.LicenseCategory
3535
import org.ossreviewtoolkit.clients.fossid.model.result.MatchType
3636
import org.ossreviewtoolkit.clients.fossid.model.result.Snippet
3737
import org.ossreviewtoolkit.model.Issue
38+
import org.ossreviewtoolkit.model.Severity
3839
import org.ossreviewtoolkit.utils.spdx.SpdxConstants
3940
import org.ossreviewtoolkit.utils.spdx.toSpdx
4041
import org.ossreviewtoolkit.utils.test.shouldNotBeNull
@@ -91,7 +92,9 @@ class FossIdLicenseMappingTest : WordSpec({
9192

9293
issues should haveSize(1)
9394
issues.first() shouldNotBeNull {
94-
message shouldStartWith "Failed to map license 'invalid license' as an SPDX expression."
95+
message shouldStartWith
96+
"Failed to map license 'invalid license' as an SPDX expression."
97+
severity shouldBe Severity.HINT
9598
}
9699
findings should haveSize(1)
97100
findings.first() shouldNotBeNull {

0 commit comments

Comments
 (0)