Skip to content

Commit 397a7fd

Browse files
committed
Apply minor Ktlint implementation refactor
1 parent f33f8be commit 397a7fd

File tree

1 file changed

+4
-5
lines changed
  • plugin-maven/src/main/java/com/diffplug/spotless/maven/kotlin

1 file changed

+4
-5
lines changed

plugin-maven/src/main/java/com/diffplug/spotless/maven/kotlin/Ktlint.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import com.diffplug.spotless.maven.FormatterStepFactory;
3232

3333
public class Ktlint implements FormatterStepFactory {
34+
private static final File defaultEditorConfig = new File(".editorconfig");
35+
3436
@Parameter
3537
private String version;
3638
@Parameter
@@ -44,11 +46,8 @@ public class Ktlint implements FormatterStepFactory {
4446
public FormatterStep newFormatterStep(final FormatterStepConfig stepConfig) {
4547
String ktlintVersion = version != null ? version : KtLintStep.defaultVersion();
4648
FileSignature configPath = null;
47-
if (editorConfigPath == null) {
48-
File defaultEditorConfig = new File(".editorconfig");
49-
if (defaultEditorConfig.exists()) {
50-
editorConfigPath = defaultEditorConfig.getPath();
51-
}
49+
if (editorConfigPath == null && defaultEditorConfig.exists()) {
50+
editorConfigPath = defaultEditorConfig.getPath();
5251
}
5352
if (editorConfigPath != null) {
5453
configPath = ThrowingEx.get(() -> FileSignature.signAsList(stepConfig.getFileLocator().locateFile(editorConfigPath)));

0 commit comments

Comments
 (0)