File tree 1 file changed +3
-17
lines changed
1 file changed +3
-17
lines changed Original file line number Diff line number Diff line change @@ -68,9 +68,9 @@ data class ScannerMatcher(
68
68
* [details]. These defaults can be overridden by the provided [config].
69
69
*/
70
70
fun create (details : ScannerDetails , config : ScannerMatcherConfig = ScannerMatcherConfig .EMPTY ): ScannerMatcher {
71
- val scannerVersion = Semver (normalizeVersion (details.version))
72
- val minVersion = parseVersion (config.minVersion) ? : scannerVersion
73
- val maxVersion = parseVersion (config.maxVersion) ? : minVersion.nextMinor()
71
+ val scannerVersion = checkNotNull( Semver .coerce (details.version))
72
+ val minVersion = Semver .coerce (config.minVersion) ? : scannerVersion
73
+ val maxVersion = Semver .coerce (config.maxVersion) ? : minVersion.nextMinor()
74
74
val name = config.regScannerName ? : details.name
75
75
val configuration = config.configuration ? : details.configuration
76
76
@@ -158,17 +158,3 @@ data class ScannerMatcherConfig(
158
158
}
159
159
}
160
160
}
161
-
162
- /* *
163
- * Parse the given [versionStr] to a [Semver] while trying to be failure tolerant.
164
- */
165
- private fun parseVersion (versionStr : String? ): Semver ? = versionStr?.let { Semver (normalizeVersion(it)) }
166
-
167
- /* *
168
- * Normalize the given [versionStr] to make sure that it can be parsed to a [Semver]. The [Semver] class
169
- * requires that all components of a semantic version number are present. This function enables a more lenient
170
- * style when declaring a version. So for instance, the user can just write "2", and this gets expanded to
171
- * "2.0.0".
172
- */
173
- private fun normalizeVersion (versionStr : String ): String =
174
- versionStr.takeIf { v -> v.count { it == ' .' } >= 2 } ? : normalizeVersion(" $versionStr .0" )
You can’t perform that action at this time.
0 commit comments