Skip to content

Commit bf9800e

Browse files
committed
Rewrite excludedPatterns expression without spread operator
According to detekt, this would have incurred a performance penalty.
1 parent 9592c11 commit bf9800e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

shared/src/main/kotlin/org/javacs/kt/SourceExclusions.kt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ class SourceExclusions(
1313
private val workspaceRoots: Collection<Path>,
1414
private val scriptsConfig: ScriptsConfiguration
1515
) {
16-
private val excludedPatterns = listOf(
17-
".*", "bazel-*", "bin", "build", "node_modules", "target",
18-
*(when {
19-
!scriptsConfig.enabled -> arrayOf("*.kts")
20-
!scriptsConfig.buildScriptsEnabled -> arrayOf("*.gradle.kts")
21-
else -> arrayOf()
22-
}),
23-
)
16+
private val excludedPatterns = (listOf(
17+
".*", "bazel-*", "bin", "build", "node_modules", "target"
18+
) + when {
19+
!scriptsConfig.enabled -> listOf("*.kts")
20+
!scriptsConfig.buildScriptsEnabled -> listOf("*.gradle.kts")
21+
else -> emptyList()
22+
})
2423
.map { FileSystems.getDefault().getPathMatcher("glob:$it") }
2524

2625
/** Finds all non-excluded files recursively. */

0 commit comments

Comments
 (0)