Skip to content

Commit d6d9005

Browse files
committed
chore(ort-run): Use a more readable syntax for finding a Regex match
The implementation is actually contains(regex: Regex): Boolean = regex.containsMatchIn(this) Signed-off-by: Sebastian Schuberth <[email protected]>
1 parent 941b521 commit d6d9005

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

services/ort-run/src/main/kotlin/PackageService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class PackageService(private val db: Database, private val ortRunService: OrtRun
128128
val idFilterRegex = Regex(filter.value, RegexOption.IGNORE_CASE)
129129

130130
filteredResult = filteredResult.filter { pkg ->
131-
pkg.pkg.identifier.mapToOrt().toCoordinates().contains(idFilterRegex)
131+
idFilterRegex.containsMatchIn(pkg.pkg.identifier.mapToOrt().toCoordinates())
132132
}
133133
}
134134

@@ -140,7 +140,7 @@ class PackageService(private val db: Database, private val ortRunService: OrtRun
140140
val purlFilterRegex = Regex(filter.value, RegexOption.IGNORE_CASE)
141141

142142
filteredResult = filteredResult.filter { pkg ->
143-
pkg.pkg.purl.contains(purlFilterRegex)
143+
purlFilterRegex.containsMatchIn(pkg.pkg.purl)
144144
}
145145
}
146146

0 commit comments

Comments
 (0)