Skip to content

Commit 187bd6e

Browse files
committed
refactor(scanner): Make ScannerMatcher.configuration non-nullable
No real use-case sets this to `null`, just a test does. Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 7f36fc3 commit 187bd6e

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

scanner/src/main/kotlin/ScannerMatcher.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ data class ScannerMatcher(
5555
val maxVersion: Semver,
5656

5757
/**
58-
* Criterion to match the [configuration][ScannerDetails.configuration] of the scanner. If `null`, all
59-
* configurations are matched.
58+
* Criterion to match the [configuration][ScannerDetails.configuration] of the scanner.
6059
*/
61-
val configuration: String?
60+
val configuration: String
6261
) {
6362
companion object {
6463
/**
@@ -94,8 +93,7 @@ data class ScannerMatcher(
9493
if (!nameRegex.matches(details.name)) return false
9594

9695
val version = Semver(details.version)
97-
return version in minVersion..<maxVersion &&
98-
(configuration == null || configuration == details.configuration)
96+
return version in minVersion..<maxVersion && configuration == details.configuration
9997
}
10098
}
10199

scanner/src/test/kotlin/ScannerMatcherTest.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,6 @@ class ScannerMatcherTest : WordSpec({
106106

107107
matcher.matches(testDetails) shouldBe false
108108
}
109-
110-
"ignore the scanner configuration if it is null" {
111-
val matcher = matchingCriteria.copy(configuration = null)
112-
113-
matcher.matches(testDetails) shouldBe true
114-
}
115109
}
116110
})
117111

0 commit comments

Comments
 (0)