Skip to content

Commit

Permalink
chore(common-utils): Simplify a condition in FileMatcher
Browse files Browse the repository at this point in the history
Avoid a multi-line `when`-clause with the explicit mention of `true` and
`false` in favor of a compact single-line `if`-statement.

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Dec 12, 2024
1 parent 50aa02b commit fc5986b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions utils/common/src/main/kotlin/FileMatcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ class FileMatcher(
* contains any.
*/
fun match(pattern: String, path: String, ignoreCase: Boolean = false) =
when (ignoreCase) {
true -> matchCaseInsensitive(pattern, path)
false -> matchCaseSensitive(pattern, path)
}
if (ignoreCase) matchCaseInsensitive(pattern, path) else matchCaseSensitive(pattern, path)

/**
* Return true if [path] is matched by any of [patterns], false otherwise. The [path] must use '/' as
Expand Down

0 comments on commit fc5986b

Please sign in to comment.