Skip to content

Commit 2ff556b

Browse files
committed
Check if EditorConfig file exist for Ktlint in KotlinGradleExtension
Follow up 959fd85.
1 parent 379a03d commit 2ff556b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

plugin-gradle/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
55
## [Unreleased]
66
### Fixed
77
* Fix Eclipse JDT on some settings files. ([#1864](https://github.com/diffplug/spotless/pull/1864) fixes [#1638](https://github.com/diffplug/spotless/issues/1638))
8+
* Check if EditorConfig file exist for Ktlint in KotlinGradleExtension. ([#1889](https://github.com/diffplug/spotless/pull/1889)
89
### Changes
910
* Bump default `ktlint` version to latest `1.0.0` -> `1.0.1`. ([#1855](https://github.com/diffplug/spotless/pull/1855))
1011
### Fixed

plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinGradleExtension.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,14 @@ public class KotlinFormatExtension {
7474
}
7575

7676
public KotlinFormatExtension setEditorConfigPath(Object editorConfigPath) throws IOException {
77-
7877
if (editorConfigPath == null) {
7978
this.editorConfigPath = null;
8079
} else {
81-
this.editorConfigPath = FileSignature.signAsList(getProject().file(editorConfigPath));
80+
File editorConfigFile = getProject().file(editorConfigPath);
81+
if (!editorConfigFile.exists()) {
82+
throw new IllegalArgumentException("EditorConfig file does not exist: " + editorConfigFile);
83+
}
84+
this.editorConfigPath = FileSignature.signAsList(editorConfigFile);
8285
}
8386
replaceStep(createStep());
8487
return this;

0 commit comments

Comments
 (0)