Skip to content

Commit c3b6876

Browse files
committed
chore(aosd): Improve the wording of validation error messages
Quote the actual value, where meaningful, to ease debugging. Closes #10744. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent a153739 commit c3b6876

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

plugins/reporters/aosd/src/main/kotlin/Aosd21Model.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,27 +108,30 @@ internal data class AOSD21(
108108
fun validate(): Component =
109109
apply {
110110
require(id >= 0L) {
111-
"A component's ID must not be negative."
111+
"A component's ID must not be negative, but it is $id."
112112
}
113113

114114
require(componentName.isNotEmpty()) {
115115
"A component's name length must not be empty."
116116
}
117117

118118
require(componentVersion.length in 1..50) {
119-
"A component's version length must be in range 1..50."
119+
"A component's version length must be in range 1..50, but '$componentVersion' has a length of " +
120+
"${componentVersion.length}."
120121
}
121122

122123
require(scmUrl.length >= 5) {
123-
"The SCM or homepage URL must have a length of at least 5."
124+
"The SCM or homepage URL must have a length of at least 5, but '$scmUrl' has a length of " +
125+
"${scmUrl.length}."
124126
}
125127

126128
require(subcomponents.isNotEmpty()) {
127129
"A component must have at least one subcomponent."
128130
}
129131

130-
require(subcomponents.first().subcomponentName == FIRST_SUBCOMPONENT_NAME) {
131-
"The first subcomponent must be named 'main'."
132+
val firstSubcomponentName = subcomponents.first().subcomponentName
133+
require(firstSubcomponentName == FIRST_SUBCOMPONENT_NAME) {
134+
"The first subcomponent must be named 'main', but is it named '$firstSubcomponentName'."
132135
}
133136
}
134137
}
@@ -184,7 +187,8 @@ internal data class AOSD21(
184187
}
185188

186189
require(licenseText.length >= 20) {
187-
"A subcomponent's license text must have a length of at least 20."
190+
"A subcomponent's license text must have a length of at least 20, but '$licenseText' has a " +
191+
"length of ${licenseText.length}."
188192
}
189193

190194
require(selectedLicense.isEmpty() || spdxId.toSpdx().isValidChoice(selectedLicense.toSpdx())) {

0 commit comments

Comments
 (0)