Skip to content

Commit 4777a9a

Browse files
committed
Simplify EditorConfigDefaults loading in KtLintCompat1Dot0Dot0Adapter
The nullability and file content have been checked in EditorConfigDefaultsLoader, seems we have no more need to inspect again. See https://github.com/pinterest/ktlint/blob/a510eedc69f7431bcd3af2162db8e53a588f4435/ktlint-rule-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/internal/EditorConfigDefaultsLoader.kt#L34-L42
1 parent 3308d33 commit 4777a9a

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lib/src/compatKtLint1Dot0Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat1Dot0Dot0Adapter.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package com.diffplug.spotless.glue.ktlint.compat;
1717

18-
import java.nio.file.Files;
1918
import java.nio.file.Path;
2019
import java.util.List;
2120
import java.util.Map;
@@ -93,12 +92,7 @@ public String format(
9392
.flatMap(loader -> loader.get().getRuleProviders().stream())
9493
.collect(Collectors.toUnmodifiableSet());
9594

96-
EditorConfigDefaults editorConfig;
97-
if (editorConfigPath == null || !Files.exists(editorConfigPath)) {
98-
editorConfig = EditorConfigDefaults.Companion.getEMPTY_EDITOR_CONFIG_DEFAULTS();
99-
} else {
100-
editorConfig = EditorConfigDefaults.Companion.load(editorConfigPath, RuleProviderKt.propertyTypes(allRuleProviders));
101-
}
95+
EditorConfigDefaults editorConfig = EditorConfigDefaults.Companion.load(editorConfigPath, RuleProviderKt.propertyTypes(allRuleProviders));
10296
EditorConfigOverride editorConfigOverride;
10397
if (editorConfigOverrideMap.isEmpty()) {
10498
editorConfigOverride = EditorConfigOverride.Companion.getEMPTY_EDITOR_CONFIG_OVERRIDE();

0 commit comments

Comments
 (0)