Skip to content
Snippets Groups Projects
Verified Commit 4767f009 authored by Jan-Niclas Strüwer's avatar Jan-Niclas Strüwer
Browse files

Added new OCCMD check

parent 138deffc
No related branches found
No related tags found
No related merge requests found
Pipeline #22256 passed
...@@ -165,6 +165,26 @@ enum class KpiKind { ...@@ -165,6 +165,26 @@ enum class KpiKind {
return "Comments in Code" return "Comments in Code"
} }
}, },
DOCUMENTATION_INFRASTRUCTURE {
override fun toViewModel(
value: Int,
children: List<KPITreeChildResponseDto>,
isEmpty: Boolean
): KPITreeResponseDto {
return KPITreeResponseDto(
value = value,
name = this.getName(),
description = "Used to approximate the the availability of documentation " +
"based upon the availability of, e.g., a wiki, and/or a docs folder.",
children = children,
isEmpty = isEmpty
)
}
override fun getName(): String {
return "Documentation Infrastructure"
}
},
// Calculated KPIs // Calculated KPIs
SIGNED_COMMITS_RATIO { SIGNED_COMMITS_RATIO {
......
...@@ -59,8 +59,7 @@ class KPIService( ...@@ -59,8 +59,7 @@ class KPIService(
val kpis = mutableListOf<RawValueKpiCreateDto>() val kpis = mutableListOf<RawValueKpiCreateDto>()
rawOccmdResults.forEach { rawOccmdResults.forEach {
val check = Checks.fromString(it.check) when (val check = Checks.fromString(it.check)) {
when (check) {
Checks.CheckedInBinaries -> Checks.CheckedInBinaries ->
kpis.add( kpis.add(
RawValueKpiCreateDto( RawValueKpiCreateDto(
...@@ -93,8 +92,16 @@ class KPIService( ...@@ -93,8 +92,16 @@ class KPIService(
) )
) )
Checks.DocumentationInfrastructure ->
kpis.add(
RawValueKpiCreateDto(
kind = KpiKind.DOCUMENTATION_INFRASTRUCTURE,
score = (it.score * 100).toInt()
)
)
else -> else ->
logger.warn("Unknown result") logger.warn("Unknown OCCMD result. $check")
} }
} }
...@@ -194,12 +201,20 @@ class KPIService( ...@@ -194,12 +201,20 @@ class KPIService(
calculationStrategy = AggregationKPICalculationStrategy() calculationStrategy = AggregationKPICalculationStrategy()
) )
documentationKpi.addChildKPI(
rawValueKpis.getOrDefault(
KpiKind.DOCUMENTATION_INFRASTRUCTURE,
KpiCalculationDto(kind = KpiKind.DOCUMENTATION_INFRASTRUCTURE)
),
0.6
)
documentationKpi.addChildKPI( documentationKpi.addChildKPI(
rawValueKpis.getOrDefault( rawValueKpis.getOrDefault(
KpiKind.COMMENTS_IN_CODE, KpiKind.COMMENTS_IN_CODE,
KpiCalculationDto(kind = KpiKind.COMMENTS_IN_CODE) KpiCalculationDto(kind = KpiKind.COMMENTS_IN_CODE)
), ),
1.0 0.4
) )
val processTransparencyKPI = KpiCalculationDto( val processTransparencyKPI = KpiCalculationDto(
......
...@@ -4,7 +4,8 @@ enum class Checks(val checkName: String) { ...@@ -4,7 +4,8 @@ enum class Checks(val checkName: String) {
SastUsageBasic("SastUsageBasic"), SastUsageBasic("SastUsageBasic"),
Secrets("Secrets"), Secrets("Secrets"),
CheckedInBinaries("CheckedInBinaries"), CheckedInBinaries("CheckedInBinaries"),
CommentsInCode("CommentsInCode"); CommentsInCode("CommentsInCode"),
DocumentationInfrastructure("ExistenceOfDocumentationInfrastructure");
companion object { companion object {
fun fromString(value: String): Checks? { fun fromString(value: String): Checks? {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.