Skip to content

Commit 7ea7112

Browse files
authored
Generate the correct qualifiedRuleId for Ktlint 0.48.x (#1502 fixes #1495).
2 parents 599d31b + 2762993 commit 7ea7112

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

lib/src/compatKtLint0Dot48Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot48Dot0Adapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private static EditorConfigOverride createEditorConfigOverride(final List<Rule>
140140
String[] parts = entry.getKey().substring(7).split("_", 2);
141141
if (parts.length == 1) {
142142
// convert ktlint_{ruleset} to {ruleset}
143-
String qualifiedRuleId = parts[0];
143+
String qualifiedRuleId = parts[0] + ":";
144144
property = RuleExecutionEditorConfigPropertyKt.createRuleSetExecutionEditorConfigProperty(qualifiedRuleId);
145145
} else {
146146
// convert ktlint_{ruleset}_{rulename} to {ruleset}:{rulename}

lib/src/testCompatKtLint0Dot48Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot48Dot0AdapterTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public void testEditorConfigCanDisable(@TempDir Path path) throws IOException {
5555
Map<String, Object> editorConfigOverrideMap = new HashMap<>();
5656
editorConfigOverrideMap.put("indent_style", "tab");
5757
editorConfigOverrideMap.put("ktlint_standard_no-semi", "disabled");
58+
// ktlint_filename is an invalid rule in ktlint 0.48.0
59+
editorConfigOverrideMap.put("ktlint_filename", "disabled");
5860

5961
String formatted = ktLintCompat0Dot48Dot0Adapter.format(text, filePath, false, false, null, userData, editorConfigOverrideMap);
6062
assertEquals("class fails_no_semicolons {\n\tval i = 0;\n}\n", formatted);

plugin-gradle/CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1010
* Prettier will now suggest to install plugins if a parser cannot be inferred from the file extension ([#1511](https://github.com/diffplug/spotless/pull/1511))
1111
### Fixed
1212
* The default list of type annotations used by `formatAnnotations` has had 8 more annotations from the Checker Framework added [#1494](https://github.com/diffplug/spotless/pull/1494)
13+
* **POTENTIALLY BREAKING** Generate the correct qualifiedRuleId for Ktlint 0.48.x [#1495](https://github.com/diffplug/spotless/pull/1495)
1314
### Changes
1415
* **POTENTIALLY BREAKING** Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475))
1516
* `KtLint` does not maintain a stable API - before this PR, we supported every breaking change in the API since 2019.

plugin-maven/CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1111
* Allow to specify node executable for node-based formatters using `nodeExecutable` parameter ([#1500](https://github.com/diffplug/spotless/pull/1500))
1212
### Fixed
1313
* The default list of type annotations used by `formatAnnotations` has had 8 more annotations from the Checker Framework added [#1494](https://github.com/diffplug/spotless/pull/1494)
14+
* **POTENTIALLY BREAKING** Generate the correct qualifiedRuleId for Ktlint 0.48.x [#1495](https://github.com/diffplug/spotless/pull/1495)
1415
### Changes
1516
* Spotless' custom build was replaced by [`maven-plugin-development`](https://github.com/britter/maven-plugin-development). ([#1496](https://github.com/diffplug/spotless/pull/1496) fixes [#554](https://github.com/diffplug/spotless/issues/554))
1617
* Prettier will now suggest to install plugins if a parser cannot be inferred from the file extension ([#1511](https://github.com/diffplug/spotless/pull/1511))

0 commit comments

Comments
 (0)