diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index e2379a8b5c..9d833b0076 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -5,6 +5,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Fixed * Fix Eclipse JDT on some settings files. ([#1864](https://github.com/diffplug/spotless/pull/1864) fixes [#1638](https://github.com/diffplug/spotless/issues/1638)) +* Check if EditorConfig file exist for Ktlint in KotlinGradleExtension. ([#1889](https://github.com/diffplug/spotless/pull/1889) ### Changes * Bump default `ktlint` version to latest `1.0.0` -> `1.0.1`. ([#1855](https://github.com/diffplug/spotless/pull/1855)) ### Fixed diff --git a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinGradleExtension.java b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinGradleExtension.java index b3351194ba..751b649491 100644 --- a/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinGradleExtension.java +++ b/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinGradleExtension.java @@ -74,11 +74,14 @@ public class KotlinFormatExtension { } public KotlinFormatExtension setEditorConfigPath(Object editorConfigPath) throws IOException { - if (editorConfigPath == null) { this.editorConfigPath = null; } else { - this.editorConfigPath = FileSignature.signAsList(getProject().file(editorConfigPath)); + File editorConfigFile = getProject().file(editorConfigPath); + if (!editorConfigFile.exists()) { + throw new IllegalArgumentException("EditorConfig file does not exist: " + editorConfigFile); + } + this.editorConfigPath = FileSignature.signAsList(editorConfigFile); } replaceStep(createStep()); return this;