Skip to content

Commit 1b35bf9

Browse files
authored
fix(ktlint): support ktlint_disabled_rules in 0.47+ (#1378 fixes #1374)
2 parents b417bcd + fb3f658 commit 1b35bf9

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1212
## [Unreleased]
1313
### Fixed
1414
* Don't treat `@Value` as a type annotation [#1367](https://github.com/diffplug/spotless/pull/1367)
15+
* Support `ktlint_disabled_rules` in `ktlint` 0.47.x [#1378](https://github.com/diffplug/spotless/pull/1378)
1516

1617
## [2.30.0] - 2022-09-14
1718
### Added

lib/src/compatKtLint0Dot47Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot47Dot0Adapter.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import static java.util.Collections.emptySet;
1919

20+
import java.util.ArrayList;
2021
import java.util.LinkedHashSet;
2122
import java.util.List;
2223
import java.util.Map;
@@ -100,9 +101,13 @@ private static EditorConfigOverride createEditorConfigOverride(final List<Rule>
100101
.filter(rule -> rule instanceof UsesEditorConfigProperties)
101102
.flatMap(rule -> ((UsesEditorConfigProperties) rule).getEditorConfigProperties().stream());
102103

104+
// get complete list of supported properties in DefaultEditorConfigProperties.INSTANCE
105+
List<UsesEditorConfigProperties.EditorConfigProperty<?>> editorConfigProperties = new ArrayList<>(DefaultEditorConfigProperties.INSTANCE.getEditorConfigProperties());
106+
editorConfigProperties.add(DefaultEditorConfigProperties.INSTANCE.getKtlintDisabledRulesProperty());
107+
103108
// Create a mapping of properties to their names based on rule properties and default properties
104109
Map<String, UsesEditorConfigProperties.EditorConfigProperty<?>> supportedProperties = Stream
105-
.concat(ruleProperties, DefaultEditorConfigProperties.INSTANCE.getEditorConfigProperties().stream())
110+
.concat(ruleProperties, editorConfigProperties.stream())
106111
.distinct()
107112
.collect(Collectors.toMap(property -> property.getType().getName(), property -> property));
108113

plugin-gradle/CHANGES.md

+1
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
* Don't treat `@Value` as a type annotation [#1367](https://github.com/diffplug/spotless/pull/1367)
8+
* Support `ktlint_disabled_rules` in `ktlint` 0.47.x [#1378](https://github.com/diffplug/spotless/pull/1378)
89

910
## [6.11.0] - 2022-09-14
1011
### Added

plugin-maven/CHANGES.md

+1
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
* Don't treat `@Value` as a type annotation [#1367](https://github.com/diffplug/spotless/pull/1367)
8+
* Support `ktlint_disabled_rules` in `ktlint` 0.47.x [#1378](https://github.com/diffplug/spotless/pull/1378)
89

910
## [2.27.2] - 2022-10-10
1011
### Fixed

0 commit comments

Comments
 (0)