From b2ee32b01ec655ba9e94810a9743fd85fe38d05b Mon Sep 17 00:00:00 2001 From: Eir Nym <485399+eirnym@users.noreply.github.com> Date: Mon, 9 Jan 2023 22:27:56 +0100 Subject: [PATCH 1/5] Drop old KtLint support(0.3x and 0.45.2) --- lib/build.gradle | 19 --- .../compat/KtLintCompat0Dot31Dot0Adapter.java | 64 ---------- .../compat/KtLintCompat0Dot32Dot0Adapter.java | 64 ---------- .../compat/KtLintCompat0Dot34Dot2Adapter.java | 68 ---------- .../compat/KtLintCompat0Dot45Dot2Adapter.java | 119 ------------------ .../glue/ktlint/KtlintFormatterFunc.java | 14 +-- 6 files changed, 1 insertion(+), 347 deletions(-) delete mode 100644 lib/src/compatKtLint0Dot31Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot31Dot0Adapter.java delete mode 100644 lib/src/compatKtLint0Dot32Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot32Dot0Adapter.java delete mode 100644 lib/src/compatKtLint0Dot34Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot34Dot2Adapter.java delete mode 100644 lib/src/compatKtLint0Dot45Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot45Dot2Adapter.java diff --git a/lib/build.gradle b/lib/build.gradle index 115d27195f..2259cfb12c 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -28,10 +28,6 @@ versionCompatibility { adapters { namespaces.register('KtLint') { versions = [ - '0.31.0', - '0.32.0', - '0.34.2', - '0.45.2', '0.46.0', '0.47.0', '0.48.0', @@ -70,21 +66,6 @@ dependencies { ktlintCompileOnly "com.pinterest.ktlint:ktlint-ruleset-experimental:$VER_KTLINT" ktlintCompileOnly "com.pinterest.ktlint:ktlint-ruleset-standard:$VER_KTLINT" - compatKtLint0Dot31Dot0CompileOnly 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20' - compatKtLint0Dot31Dot0CompileOnly 'com.github.shyiko.ktlint:ktlint-core:0.31.0' - compatKtLint0Dot31Dot0CompileOnly 'com.github.shyiko.ktlint:ktlint-ruleset-experimental:0.31.0' - compatKtLint0Dot31Dot0CompileOnly 'com.github.shyiko.ktlint:ktlint-ruleset-standard:0.31.0' - compatKtLint0Dot32Dot0CompileOnly 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20' - compatKtLint0Dot32Dot0CompileOnly 'com.pinterest.ktlint:ktlint-core:0.32.0' - compatKtLint0Dot32Dot0CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-experimental:0.32.0' - compatKtLint0Dot32Dot0CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.32.0' - compatKtLint0Dot34Dot2CompileOnly 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20' - compatKtLint0Dot34Dot2CompileOnly 'com.pinterest.ktlint:ktlint-core:0.34.2' - compatKtLint0Dot34Dot2CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-experimental:0.34.2' - compatKtLint0Dot34Dot2CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.34.2' - compatKtLint0Dot45Dot2CompileOnly 'com.pinterest.ktlint:ktlint-core:0.45.2' - compatKtLint0Dot45Dot2CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-experimental:0.45.2' - compatKtLint0Dot45Dot2CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.45.2' compatKtLint0Dot46Dot0CompileOnly 'com.pinterest.ktlint:ktlint-core:0.46.0' compatKtLint0Dot46Dot0CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-experimental:0.46.0' compatKtLint0Dot46Dot0CompileOnly 'com.pinterest.ktlint:ktlint-ruleset-standard:0.46.0' diff --git a/lib/src/compatKtLint0Dot31Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot31Dot0Adapter.java b/lib/src/compatKtLint0Dot31Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot31Dot0Adapter.java deleted file mode 100644 index 7a956de86a..0000000000 --- a/lib/src/compatKtLint0Dot31Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot31Dot0Adapter.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2022-2023 DiffPlug - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.diffplug.spotless.glue.ktlint.compat; - -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import com.github.shyiko.ktlint.core.KtLint; -import com.github.shyiko.ktlint.core.LintError; -import com.github.shyiko.ktlint.core.RuleSet; -import com.github.shyiko.ktlint.ruleset.experimental.ExperimentalRuleSetProvider; -import com.github.shyiko.ktlint.ruleset.standard.StandardRuleSetProvider; - -import kotlin.Unit; -import kotlin.jvm.functions.Function2; - -public class KtLintCompat0Dot31Dot0Adapter implements KtLintCompatAdapter { - - static class FormatterCallback implements Function2 { - @Override - public Unit invoke(LintError lint, Boolean corrected) { - if (!corrected) { - KtLintCompatReporting.report(lint.getLine(), lint.getCol(), lint.getRuleId(), lint.getDetail()); - } - return null; - } - } - - @Override - public String format(final String text, Path path, final boolean isScript, - final boolean useExperimental, - Path editorConfigPath, final Map userData, - final Map editorConfigOverrideMap) { - final FormatterCallback formatterCallback = new FormatterCallback(); - - final List rulesets = new ArrayList<>(); - rulesets.add(new StandardRuleSetProvider().get()); - - if (useExperimental) { - rulesets.add(new ExperimentalRuleSetProvider().get()); - } - - return KtLint.INSTANCE.format( - text, - rulesets, - userData, - formatterCallback); - } -} diff --git a/lib/src/compatKtLint0Dot32Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot32Dot0Adapter.java b/lib/src/compatKtLint0Dot32Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot32Dot0Adapter.java deleted file mode 100644 index 94c41c3716..0000000000 --- a/lib/src/compatKtLint0Dot32Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot32Dot0Adapter.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2022-2023 DiffPlug - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.diffplug.spotless.glue.ktlint.compat; - -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import com.pinterest.ktlint.core.KtLint; -import com.pinterest.ktlint.core.LintError; -import com.pinterest.ktlint.core.RuleSet; -import com.pinterest.ktlint.ruleset.experimental.ExperimentalRuleSetProvider; -import com.pinterest.ktlint.ruleset.standard.StandardRuleSetProvider; - -import kotlin.Unit; -import kotlin.jvm.functions.Function2; - -public class KtLintCompat0Dot32Dot0Adapter implements KtLintCompatAdapter { - - static class FormatterCallback implements Function2 { - @Override - public Unit invoke(LintError lint, Boolean corrected) { - if (!corrected) { - KtLintCompatReporting.report(lint.getLine(), lint.getCol(), lint.getRuleId(), lint.getDetail()); - } - return null; - } - } - - @Override - public String format(final String text, Path path, final boolean isScript, - final boolean useExperimental, - Path editorConfigPath, final Map userData, - final Map editorConfigOverrideMap) { - final FormatterCallback formatterCallback = new FormatterCallback(); - - final List rulesets = new ArrayList<>(); - rulesets.add(new StandardRuleSetProvider().get()); - - if (useExperimental) { - rulesets.add(new ExperimentalRuleSetProvider().get()); - } - - return KtLint.INSTANCE.format( - text, - rulesets, - userData, - formatterCallback); - } -} diff --git a/lib/src/compatKtLint0Dot34Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot34Dot2Adapter.java b/lib/src/compatKtLint0Dot34Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot34Dot2Adapter.java deleted file mode 100644 index 1b8509902c..0000000000 --- a/lib/src/compatKtLint0Dot34Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot34Dot2Adapter.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2022-2023 DiffPlug - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.diffplug.spotless.glue.ktlint.compat; - -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import com.pinterest.ktlint.core.KtLint; -import com.pinterest.ktlint.core.LintError; -import com.pinterest.ktlint.core.RuleSet; -import com.pinterest.ktlint.ruleset.experimental.ExperimentalRuleSetProvider; -import com.pinterest.ktlint.ruleset.standard.StandardRuleSetProvider; - -import kotlin.Unit; -import kotlin.jvm.functions.Function2; - -public class KtLintCompat0Dot34Dot2Adapter implements KtLintCompatAdapter { - - static class FormatterCallback implements Function2 { - @Override - public Unit invoke(LintError lint, Boolean corrected) { - if (!corrected) { - KtLintCompatReporting.report(lint.getLine(), lint.getCol(), lint.getRuleId(), lint.getDetail()); - } - return null; - } - } - - @Override - public String format(final String text, Path path, final boolean isScript, - final boolean useExperimental, - Path editorConfigPath, final Map userData, - final Map editorConfigOverrideMap) { - final FormatterCallback formatterCallback = new FormatterCallback(); - - final List rulesets = new ArrayList<>(); - rulesets.add(new StandardRuleSetProvider().get()); - - if (useExperimental) { - rulesets.add(new ExperimentalRuleSetProvider().get()); - } - - return KtLint.INSTANCE.format(new KtLint.Params( - path.toFile().getAbsolutePath(), - text, - rulesets, - userData, - formatterCallback, - isScript, - editorConfigPath == null ? null : editorConfigPath.toFile().getAbsolutePath(), - false)); - } -} diff --git a/lib/src/compatKtLint0Dot45Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot45Dot2Adapter.java b/lib/src/compatKtLint0Dot45Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot45Dot2Adapter.java deleted file mode 100644 index 23fb2b4c5c..0000000000 --- a/lib/src/compatKtLint0Dot45Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot45Dot2Adapter.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2022-2023 DiffPlug - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.diffplug.spotless.glue.ktlint.compat; - -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import com.pinterest.ktlint.core.KtLint; -import com.pinterest.ktlint.core.LintError; -import com.pinterest.ktlint.core.RuleSet; -import com.pinterest.ktlint.core.api.DefaultEditorConfigProperties; -import com.pinterest.ktlint.core.api.EditorConfigOverride; -import com.pinterest.ktlint.core.api.UsesEditorConfigProperties; -import com.pinterest.ktlint.ruleset.experimental.ExperimentalRuleSetProvider; -import com.pinterest.ktlint.ruleset.standard.StandardRuleSetProvider; - -import kotlin.Pair; -import kotlin.Unit; -import kotlin.jvm.functions.Function2; - -public class KtLintCompat0Dot45Dot2Adapter implements KtLintCompatAdapter { - - static class FormatterCallback implements Function2 { - @Override - public Unit invoke(LintError lint, Boolean corrected) { - if (!corrected) { - KtLintCompatReporting.report(lint.getLine(), lint.getCol(), lint.getRuleId(), lint.getDetail()); - } - return null; - } - } - - @Override - public String format(final String text, Path path, final boolean isScript, - final boolean useExperimental, - Path editorConfigPath, final Map userData, - final Map editorConfigOverrideMap) { - final FormatterCallback formatterCallback = new FormatterCallback(); - - final List rulesets = new ArrayList<>(); - rulesets.add(new StandardRuleSetProvider().get()); - - if (useExperimental) { - rulesets.add(new ExperimentalRuleSetProvider().get()); - } - - EditorConfigOverride editorConfigOverride; - if (editorConfigOverrideMap.isEmpty()) { - editorConfigOverride = EditorConfigOverride.Companion.getEmptyEditorConfigOverride(); - } else { - editorConfigOverride = createEditorConfigOverride(rulesets, editorConfigOverrideMap); - } - - return KtLint.INSTANCE.format(new KtLint.ExperimentalParams( - path.toFile().getAbsolutePath(), - text, - rulesets, - userData, - formatterCallback, - isScript, - editorConfigPath == null ? null : editorConfigPath.toFile().getAbsolutePath(), - false, - editorConfigOverride, - false)); - } - - /** - * Create EditorConfigOverride from user provided parameters. - * Calling this method requires KtLint 0.45.2. - */ - private static EditorConfigOverride createEditorConfigOverride(final List rulesets, Map editorConfigOverrideMap) { - // Get properties from rules in the rule sets - Stream> ruleProperties = rulesets.stream() - .flatMap(ruleSet -> Arrays.stream(ruleSet.getRules())) - .filter(rule -> rule instanceof UsesEditorConfigProperties) - .flatMap(rule -> ((UsesEditorConfigProperties) rule).getEditorConfigProperties().stream()); - - // Create a mapping of properties to their names based on rule properties and default properties - Map> supportedProperties = Stream - .concat(ruleProperties, DefaultEditorConfigProperties.INSTANCE.getDefaultEditorConfigProperties().stream()) - .distinct() - .collect(Collectors.toMap(property -> property.getType().getName(), property -> property)); - - // Create config properties based on provided property names and values - @SuppressWarnings("unchecked") - Pair, ?>[] properties = editorConfigOverrideMap.entrySet().stream() - .map(entry -> { - UsesEditorConfigProperties.EditorConfigProperty property = supportedProperties.get(entry.getKey()); - if (property != null) { - return new Pair<>(property, entry.getValue()); - } else { - return null; - } - }) - .filter(Objects::nonNull) - .toArray(Pair[]::new); - - return EditorConfigOverride.Companion.from(properties); - } -} diff --git a/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java b/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java index e6f3715d25..02ff5355e3 100644 --- a/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java +++ b/lib/src/ktlint/java/com/diffplug/spotless/glue/ktlint/KtlintFormatterFunc.java @@ -44,21 +44,9 @@ public KtlintFormatterFunc(String version, boolean isScript, boolean useExperime } else if (minorVersion == 47) { // rename RuleSet to RuleProvider this.adapter = new KtLintCompat0Dot47Dot0Adapter(); - } else if (minorVersion >= 46) { + } else { // DefaultEditorConfigProperties.INSTANCE.getDefaultEditorConfigProperties() renamed to .getEditorConfigProperties() this.adapter = new KtLintCompat0Dot46Dot0Adapter(); - } else if (version.equals("0.45.2")) { - // add editorConfigOverride - this.adapter = new KtLintCompat0Dot45Dot2Adapter(); - } else if (minorVersion >= 34) { - // KtLint.INSTANCE.format() now needs more parameters - this.adapter = new KtLintCompat0Dot34Dot2Adapter(); - } else if (minorVersion >= 32) { - // rename packages from `com.github.shyiko` to `com.pinterest` - this.adapter = new KtLintCompat0Dot32Dot0Adapter(); - } else { - // the OG - this.adapter = new KtLintCompat0Dot31Dot0Adapter(); } this.editorConfigPath = editorConfigPath; this.useExperimental = useExperimental; From a80c0eb3a53c009118357fe20a8d2d61e31ed087 Mon Sep 17 00:00:00 2001 From: Eir Nym <485399+eirnym@users.noreply.github.com> Date: Mon, 9 Jan 2023 22:35:31 +0100 Subject: [PATCH 2/5] Update changelog --- CHANGES.md | 3 +++ plugin-gradle/CHANGES.md | 2 ++ plugin-maven/CHANGES.md | 2 ++ 3 files changed, 7 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index f0db002dc1..2adb7a92a3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,9 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * Switch our publishing infrastructure from CircleCI to GitHub Actions ([#1462](https://github.com/diffplug/spotless/pull/1462)). * Help wanted for moving our tests too ([#1472](https://github.com/diffplug/spotless/issues/1472)) +#### Removed +* Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475)) + ## [2.31.1] - 2023-01-02 ### Fixed * Improve memory usage when using git ratchet ([#1426](https://github.com/diffplug/spotless/pull/1426)) diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index e8758188b6..771dfcb558 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -12,6 +12,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * Support `ktlint` 0.48+ new rule disabling syntax ([#1456](https://github.com/diffplug/spotless/pull/1456)) fixes ([#1444](https://github.com/diffplug/spotless/issues/1444)) ### Changes * Bump default `ktlint` version to latest `0.47.1` -> `0.48.1` ([#1456](https://github.com/diffplug/spotless/pull/1456)) +#### Removed +* Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475)) ## [6.12.1] - 2023-01-02 ### Fixed diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index cb38f95de1..024c0ebf24 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -13,6 +13,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ### Changes * Bump default `ktlint` version to latest `0.47.1` -> `0.48.1` ([#1456](https://github.com/diffplug/spotless/pull/1456)) * Reduce spurious invalidations of the up-to-date index file ([#1461](https://github.com/diffplug/spotless/pull/1461)) +#### Removed +* Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475)) ## [2.29.0] - 2023-01-02 ### Added From 4b2097c3ed3a1ef7ee9550aa20e7a02948106b07 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Tue, 17 Jan 2023 15:25:09 -0800 Subject: [PATCH 3/5] Update changelogs. --- CHANGES.md | 6 ++++-- lib/build.gradle | 3 +++ plugin-gradle/CHANGES.md | 6 ++++-- plugin-maven/CHANGES.md | 6 ++++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 45627807f3..0bdcf657b2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ### Fixed * 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) ### Changes +#### Removed +* Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475)) + * `KtLint` does not maintain a stable API - before this PR, we supported every breaking change in the API since 2019. + * From now on, we will support no more than 2 breaking changes at a time. ## [2.32.0] - 2023-01-13 ### Added @@ -39,8 +43,6 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * Bump default `ktlint` version to latest `0.47.1` -> `0.48.1` ([#1456](https://github.com/diffplug/spotless/pull/1456)) * Switch our publishing infrastructure from CircleCI to GitHub Actions ([#1462](https://github.com/diffplug/spotless/pull/1462)). * Help wanted for moving our tests too ([#1472](https://github.com/diffplug/spotless/issues/1472)) -#### Removed -* Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475)) ## [2.31.1] - 2023-01-02 ### Fixed diff --git a/lib/build.gradle b/lib/build.gradle index 7e2496139c..fc2c1c04a0 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -28,6 +28,9 @@ for (glue in NEEDS_GLUE) { versionCompatibility { adapters { namespaces.register('KtLint') { + // as discussed at https://github.com/diffplug/spotless/pull/1475 + // we will support no more than 2 breaking changes at a time = 3 incompatible versions + // we will try to drop down to only one version if a stable API can be maintained for a full year versions = [ '0.46.0', '0.47.0', diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index 84fc0f4d83..bc4f2bd5e5 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -7,6 +7,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ### Fixed * 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) ### Changes +#### Removed +* Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475)) + * `KtLint` does not maintain a stable API - before this PR, we supported every breaking change in the API since 2019. + * From now on, we will support no more than 2 breaking changes at a time. ## [6.13.0] - 2023-01-14 ### Added @@ -22,8 +26,6 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ### Changes * Bump default `ktlint` version to latest `0.47.1` -> `0.48.1` ([#1456](https://github.com/diffplug/spotless/pull/1456)) * Bump default version for `prettier` from `2.0.5` to `2.8.1` ([#1453](https://github.com/diffplug/spotless/pull/1453)) -#### Removed -* Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475)) ## [6.12.1] - 2023-01-02 ### Fixed diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 7556875183..ce07394b98 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -8,6 +8,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * 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) ### Changes * 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)) +#### Removed +* Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475)) + * `KtLint` does not maintain a stable API - before this PR, we supported every breaking change in the API since 2019. + * From now on, we will support no more than 2 breaking changes at a time. ## [2.30.0] - 2023-01-13 ### Added @@ -25,8 +29,6 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( * Bump default `ktlint` version to latest `0.47.1` -> `0.48.1` ([#1456](https://github.com/diffplug/spotless/pull/1456)) * Reduce spurious invalidations of the up-to-date index file ([#1461](https://github.com/diffplug/spotless/pull/1461)) * Bump default version for `prettier` from `2.0.5` to `2.8.1` ([#1453](https://github.com/diffplug/spotless/pull/1453)) -#### Removed -* Removed support for KtLint 0.3x and 0.45.2 ([#1475](https://github.com/diffplug/spotless/pull/1475)) ## [2.29.0] - 2023-01-02 ### Added From 9982c3a7f30cd3a12467f9fb7f18fde6b155a815 Mon Sep 17 00:00:00 2001 From: Eir Nym <485399+eirnym@users.noreply.github.com> Date: Wed, 25 Jan 2023 02:08:01 +0100 Subject: [PATCH 4/5] Drop some old tests --- .../spotless/kotlin/KtLintStepTest.java | 62 ------------------- 1 file changed, 62 deletions(-) diff --git a/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java b/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java index 1be0c7b72f..f69d038b6a 100644 --- a/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java +++ b/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java @@ -37,68 +37,6 @@ void behavior() { "Wildcard import"); } - @Test - void worksShyiko() { - FormatterStep step = KtLintStep.create("0.31.0", TestProvisioner.mavenCentral()); - StepHarnessWithFile.forStep(this, step) - .testResource("kotlin/ktlint/basic.dirty", "kotlin/ktlint/basic.clean") - .testResourceExceptionMsg("kotlin/ktlint/unsolvable.dirty").isEqualTo( - "Error on line: 1, column: 1\n" + - "rule: no-wildcard-imports\n" + - "Wildcard import"); - } - - // Regression test to ensure it works on the version it switched to Pinterest (version 0.32.0) - // but before 0.34. - // https://github.com/diffplug/spotless/issues/419 - @Test - void worksPinterestAndPre034() { - FormatterStep step = KtLintStep.create("0.32.0", TestProvisioner.mavenCentral()); - StepHarnessWithFile.forStep(this, step) - .testResource("kotlin/ktlint/basic.dirty", "kotlin/ktlint/basic.clean") - .testResourceExceptionMsg("kotlin/ktlint/unsolvable.dirty").isEqualTo("Error on line: 1, column: 1\n" + - "rule: no-wildcard-imports\n" + - "Wildcard import"); - } - - // Regression test to handle alpha and 1.x version numbers - // https://github.com/diffplug/spotless/issues/668 - @Test - void worksAlpha1() { - FormatterStep step = KtLintStep.create("0.38.0-alpha01", TestProvisioner.mavenCentral()); - StepHarness.forStep(step) - .testResource("kotlin/ktlint/basic.dirty", "kotlin/ktlint/basic.clean"); - } - - @Test - void works0_44_0() { - FormatterStep step = KtLintStep.create("0.44.0", TestProvisioner.mavenCentral()); - StepHarness.forStep(step) - .testResource("kotlin/ktlint/basic.dirty", "kotlin/ktlint/basic.clean"); - } - - @Disabled("https://github.com/pinterest/ktlint/issues/1421") - @Test - void works0_45_0() { - FormatterStep step = KtLintStep.create("0.45.0", TestProvisioner.mavenCentral()); - StepHarness.forStep(step) - .testResource("kotlin/ktlint/basic.dirty", "kotlin/ktlint/basic.clean"); - } - - @Test - void works0_45_1() { - FormatterStep step = KtLintStep.create("0.45.1", TestProvisioner.mavenCentral()); - StepHarness.forStep(step) - .testResource("kotlin/ktlint/basic.dirty", "kotlin/ktlint/basic.clean"); - } - - @Test - void works0_45_2() { - FormatterStep step = KtLintStep.create("0.45.2", TestProvisioner.mavenCentral()); - StepHarness.forStep(step) - .testResource("kotlin/ktlint/basic.dirty", "kotlin/ktlint/basic.clean"); - } - @Test void works0_46_0() { FormatterStep step = KtLintStep.create("0.46.0", TestProvisioner.mavenCentral()); From aab121d345486bbc4a9eaf8ac9d4ef3bd1417622 Mon Sep 17 00:00:00 2001 From: Eir Nym <485399+eirnym@users.noreply.github.com> Date: Wed, 25 Jan 2023 02:14:48 +0100 Subject: [PATCH 5/5] Remove stale imports --- .../test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java b/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java index f69d038b6a..3047245298 100644 --- a/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java +++ b/testlib/src/test/java/com/diffplug/spotless/kotlin/KtLintStepTest.java @@ -15,13 +15,11 @@ */ package com.diffplug.spotless.kotlin; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import com.diffplug.spotless.FormatterStep; import com.diffplug.spotless.ResourceHarness; import com.diffplug.spotless.SerializableEqualityTester; -import com.diffplug.spotless.StepHarness; import com.diffplug.spotless.StepHarnessWithFile; import com.diffplug.spotless.TestProvisioner;