File tree Expand file tree Collapse file tree 6 files changed +11
-7
lines changed
main/kotlin/tables/runs/evaluator
model/src/commonMain/kotlin/runs Expand file tree Collapse file tree 6 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ package org.eclipse.apoapsis.ortserver.dao.tables.runs.evaluator
2121
2222import org.eclipse.apoapsis.ortserver.dao.tables.runs.shared.IdentifierDao
2323import org.eclipse.apoapsis.ortserver.dao.tables.runs.shared.IdentifiersTable
24+ import org.eclipse.apoapsis.ortserver.model.Severity
2425import org.eclipse.apoapsis.ortserver.model.runs.OrtRuleViolation
2526
2627import org.jetbrains.exposed.dao.LongEntity
@@ -37,7 +38,7 @@ object RuleViolationsTable : LongIdTable("rule_violations") {
3738 val packageIdentifierId = reference(" package_identifier_id" , IdentifiersTable ).nullable()
3839 val license = text(" license" ).nullable()
3940 val licenseSource = text(" license_source" ).nullable()
40- val severity = text (" severity" )
41+ val severity = enumerationByName< Severity > (" severity" , 128 )
4142 val message = text(" message" )
4243 val howToFix = text(" how_to_fix" )
4344}
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ import org.eclipse.apoapsis.ortserver.model.NotifierJobConfiguration
5252import org.eclipse.apoapsis.ortserver.model.ReporterJobConfiguration
5353import org.eclipse.apoapsis.ortserver.model.RepositoryType
5454import org.eclipse.apoapsis.ortserver.model.ScannerJobConfiguration
55+ import org.eclipse.apoapsis.ortserver.model.Severity
5556import org.eclipse.apoapsis.ortserver.model.runs.OrtRuleViolation
5657
5758import org.jetbrains.exposed.sql.Database
@@ -202,7 +203,7 @@ class Fixtures(private val db: Database) {
202203 license = " license" ,
203204 licenseSource = " license source" ,
204205 message = " message" ,
205- severity = " severity " ,
206+ severity = Severity . ERROR ,
206207 howToFix = " how to fix"
207208 )
208209}
Original file line number Diff line number Diff line change @@ -21,13 +21,15 @@ package org.eclipse.apoapsis.ortserver.model.runs
2121
2222import kotlinx.serialization.Serializable
2323
24+ import org.eclipse.apoapsis.ortserver.model.Severity
25+
2426@Serializable
2527data class OrtRuleViolation (
2628 val rule : String ,
2729 val packageId : Identifier ? ,
2830 val license : String? ,
2931 val licenseSource : String? ,
30- val severity : String ,
32+ val severity : Severity ,
3133 val message : String ,
3234 val howToFix : String
3335)
Original file line number Diff line number Diff line change @@ -466,7 +466,7 @@ fun OrtRootDependencyIndex.mapToModel() =
466466fun OrtRuleViolation.mapToModel () = RuleViolation (
467467 rule = rule,
468468 packageId = pkg?.mapToModel(),
469- severity = severity.name ,
469+ severity = severity.mapToModel() ,
470470 message = message,
471471 howToFix = howToFix,
472472 license = license?.toString(),
Original file line number Diff line number Diff line change @@ -579,7 +579,7 @@ fun RuleViolation.mapToOrt() =
579579 pkg = packageId?.mapToOrt(),
580580 license = license?.let { SpdxSingleLicenseExpression .parse(it) },
581581 licenseSource = licenseSource?.let { LicenseSource .valueOf(it) },
582- severity = OrtSeverity .valueOf(severity ),
582+ severity = severity.mapToOrt( ),
583583 message = message,
584584 howToFix = howToFix
585585 )
Original file line number Diff line number Diff line change @@ -732,7 +732,7 @@ class OrtRunServiceTest : WordSpec({
732732 fixtures.identifier,
733733 license = "license",
734734 licenseSource = "license source",
735- severity = " ERROR " ,
735+ severity = Severity . ERROR ,
736736 message = "the rule is violated",
737737 howToFix = "how to fix info"
738738 )
@@ -757,7 +757,7 @@ class OrtRunServiceTest : WordSpec({
757757 fixtures.identifier,
758758 license = "license",
759759 licenseSource = "license source",
760- severity = " ERROR " ,
760+ severity = Severity . ERROR ,
761761 message = "the rule is violated",
762762 howToFix = howToFix
763763 )
You can’t perform that action at this time.
0 commit comments