Skip to content

Commit

Permalink
Rewrite excludedPatterns expression without spread operator
Browse files Browse the repository at this point in the history
According to detekt, this would have incurred a performance penalty.
  • Loading branch information
fwcd committed Jan 15, 2024
1 parent 9592c11 commit bf9800e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions shared/src/main/kotlin/org/javacs/kt/SourceExclusions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ class SourceExclusions(
private val workspaceRoots: Collection<Path>,
private val scriptsConfig: ScriptsConfiguration
) {
private val excludedPatterns = listOf(
".*", "bazel-*", "bin", "build", "node_modules", "target",
*(when {
!scriptsConfig.enabled -> arrayOf("*.kts")
!scriptsConfig.buildScriptsEnabled -> arrayOf("*.gradle.kts")
else -> arrayOf()
}),
)
private val excludedPatterns = (listOf(
".*", "bazel-*", "bin", "build", "node_modules", "target"
) + when {
!scriptsConfig.enabled -> listOf("*.kts")
!scriptsConfig.buildScriptsEnabled -> listOf("*.gradle.kts")
else -> emptyList()
})
.map { FileSystems.getDefault().getPathMatcher("glob:$it") }

/** Finds all non-excluded files recursively. */
Expand Down

0 comments on commit bf9800e

Please sign in to comment.