Skip to content

Commit 7cb6818

Browse files
Juli0qsschuberth
authored andcommitted
feat(fossid): Add option to treat pending identifications as errors
While a pending identification is not per se an issue, because it is a call to action and not a finding, some users might want that ORT shows it with the severity ERROR to ensure pending identifications are not overlooked in CI/CD pipelines or compliance workflows where only errors are considered blocking issues. Signed-off-by: Julian Olderdissen <[email protected]>
1 parent 480ce54 commit 7cb6818

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

model/src/main/resources/reference.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ ort:
277277

278278
sensitivity: 10
279279

280+
treatPendingIdentificationsAsError: false
281+
280282
secrets:
281283
user: user
282284
apiKey: XYZ

model/src/test/kotlin/config/OrtConfigurationTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@ class OrtConfigurationTest : WordSpec({
259259
"detectCopyrightStatements" to "true",
260260
"timeout" to "60",
261261
"urlMappings" to urlMapping,
262-
"sensitivity" to "10"
262+
"sensitivity" to "10",
263+
"treatPendingIdentificationsAsError" to "false"
263264
)
264265

265266
secrets should containExactlyEntries(

plugins/scanners/fossid/src/main/kotlin/FossId.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ class FossId internal constructor(
907907
source = descriptor.id,
908908
message = "This scan has $pendingFilesCount file(s) pending identification in FossID. " +
909909
"Please review and resolve them at: $fossIdScanUrl",
910-
severity = Severity.HINT
910+
severity = if (config.treatPendingIdentificationsAsError) Severity.ERROR else Severity.HINT
911911
)
912912
)
913913

plugins/scanners/fossid/src/main/kotlin/FossIdConfig.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ data class FossIdConfig(
131131

132132
/** Whether to write scan results to the storage. */
133133
@OrtPluginOption(defaultValue = "true")
134-
val writeToStorage: Boolean
134+
val writeToStorage: Boolean,
135+
136+
/** Treat pending identifications as errors instead of hints. */
137+
@OrtPluginOption(defaultValue = "false")
138+
val treatPendingIdentificationsAsError: Boolean
135139
) {
136140
init {
137141
require(deltaScanLimit > 0) {

plugins/scanners/fossid/src/test/kotlin/TestUtils.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ internal fun createConfig(
152152
urlMappings = null,
153153
writeToStorage = false,
154154
logRequests = false,
155-
isArchiveMode = isArchiveMode
155+
isArchiveMode = isArchiveMode,
156+
treatPendingIdentificationsAsError = false
156157
)
157158

158159
val namingProvider = createNamingProviderMock()

0 commit comments

Comments
 (0)