Skip to content

Commit 890ead9

Browse files
committed
Merge remote-tracking branch 'origin/main' into IntroduceYamlJvmBased_withJackson
2 parents 4438d18 + 9df1809 commit 890ead9

File tree

106 files changed

+3111
-354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+3111
-354
lines changed

.github/workflows/changelog-print.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
with:
1616
java-version: 11
1717
distribution: 'temurin'
18+
cache: 'gradle'
1819
- name: gradle caching
1920
uses: gradle/gradle-build-action@v2
2021
- run: ./gradlew changelogPrint

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
with:
4242
java-version: 11
4343
distribution: 'temurin'
44+
cache: 'gradle'
4445
- name: gradle caching
4546
uses: gradle/gradle-build-action@v2
4647
- name: publish all

.java-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
11.0

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1111

1212
## [Unreleased]
1313
### Added
14+
* Add option `editorConfigFile` for `ktLint` [#142](https://github.com/diffplug/spotless/issues/142)
15+
* **POTENTIALLY BREAKING** `ktlint` step now modifies license headers. Make sure to put `licenseHeader` *after* `ktlint`.
1416
* Added `skipLinesMatching` option to `licenseHeader` to support formats where license header cannot be immediately added to the top of the file (e.g. xml, sh). ([#1441](https://github.com/diffplug/spotless/pull/1441)).
1517
* Add YAML support through Jackson ([#1478](https://github.com/diffplug/spotless/pull/1478))
1618
### Fixed
1719
* 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))
20+
* Added support for npm-based [ESLint](https://eslint.org/)-formatter for javascript and typescript ([#1453](https://github.com/diffplug/spotless/pull/1453))
1821

1922
### Changes
23+
* Bump default version for `prettier` from `2.0.5` to `2.8.1` ([#1453](https://github.com/diffplug/spotless/pull/1453))
2024
* Bump the dev version of Gradle from `7.5.1` to `7.6` ([#1409](https://github.com/diffplug/spotless/pull/1409))
2125
* We also removed the no-longer-required dependency `org.codehaus.groovy:groovy-xml`
2226
* Breaking changes to Spotless' internal testing infrastructure `testlib` ([#1443](https://github.com/diffplug/spotless/pull/1443))
@@ -28,6 +32,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
2832
* Switch our publishing infrastructure from CircleCI to GitHub Actions ([#1462](https://github.com/diffplug/spotless/pull/1462)).
2933
* Help wanted for moving our tests too ([#1472](https://github.com/diffplug/spotless/issues/1472))
3034

35+
3136
## [2.31.1] - 2023-01-02
3237
### Fixed
3338
* Improve memory usage when using git ratchet ([#1426](https://github.com/diffplug/spotless/pull/1426))

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,14 @@ lib('java.PalantirJavaFormatStep') +'{{yes}} | {{yes}}
6262
lib('java.RemoveUnusedImportsStep') +'{{yes}} | {{yes}} | {{yes}} | {{no}} |',
6363
extra('java.EclipseJdtFormatterStep') +'{{yes}} | {{yes}} | {{yes}} | {{no}} |',
6464
lib('java.FormatAnnotationsStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
65-
lib('json.gson.GsonStep') +'{{yes}} | {{no}} | {{no}} | {{no}} |',
66-
lib('json.JsonSimpleStep') +'{{yes}} | {{no}} | {{no}} | {{no}} |',
65+
lib('json.gson.GsonStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
66+
lib('json.JsonSimpleStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
6767
lib('kotlin.KtLintStep') +'{{yes}} | {{yes}} | {{yes}} | {{no}} |',
6868
lib('kotlin.KtfmtStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
6969
lib('kotlin.DiktatStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
7070
lib('markdown.FreshMarkStep') +'{{yes}} | {{no}} | {{no}} | {{no}} |',
7171
lib('markdown.FlexmarkStep') +'{{no}} | {{yes}} | {{no}} | {{no}} |',
72+
lib('npm.EslintFormatterStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
7273
lib('npm.PrettierFormatterStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
7374
lib('npm.TsFmtFormatterStep') +'{{yes}} | {{yes}} | {{no}} | {{no}} |',
7475
lib('pom.SortPomStep') +'{{no}} | {{yes}} | {{no}} | {{no}} |',
@@ -106,13 +107,14 @@ extra('wtp.EclipseWtpFormatterStep') +'{{yes}} | {{yes}}
106107
| [`java.RemoveUnusedImportsStep`](lib/src/main/java/com/diffplug/spotless/java/RemoveUnusedImportsStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
107108
| [`java.EclipseJdtFormatterStep`](lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
108109
| [`java.FormatAnnotationsStep`](lib/src/main/java/com/diffplug/spotless/java/FormatAnnotationsStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
109-
| [`json.gson.GsonStep`](lib/src/main/java/com/diffplug/spotless/json/gson/GsonStep.java) | :+1: | :white_large_square: | :white_large_square: | :white_large_square: |
110-
| [`json.JsonSimpleStep`](lib/src/main/java/com/diffplug/spotless/json/JsonSimpleStep.java) | :+1: | :white_large_square: | :white_large_square: | :white_large_square: |
110+
| [`json.gson.GsonStep`](lib/src/main/java/com/diffplug/spotless/json/gson/GsonStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
111+
| [`json.JsonSimpleStep`](lib/src/main/java/com/diffplug/spotless/json/JsonSimpleStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
111112
| [`kotlin.KtLintStep`](lib/src/main/java/com/diffplug/spotless/kotlin/KtLintStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
112113
| [`kotlin.KtfmtStep`](lib/src/main/java/com/diffplug/spotless/kotlin/KtfmtStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
113114
| [`kotlin.DiktatStep`](lib/src/main/java/com/diffplug/spotless/kotlin/DiktatStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
114115
| [`markdown.FreshMarkStep`](lib/src/main/java/com/diffplug/spotless/markdown/FreshMarkStep.java) | :+1: | :white_large_square: | :white_large_square: | :white_large_square: |
115116
| [`markdown.FlexmarkStep`](lib/src/main/java/com/diffplug/spotless/markdown/FlexmarkStep.java) | :white_large_square: | :+1: | :white_large_square: | :white_large_square: |
117+
| [`npm.EslintFormatterStep`](lib/src/main/java/com/diffplug/spotless/npm/EslintFormatterStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
116118
| [`npm.PrettierFormatterStep`](lib/src/main/java/com/diffplug/spotless/npm/PrettierFormatterStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
117119
| [`npm.TsFmtFormatterStep`](lib/src/main/java/com/diffplug/spotless/npm/TsFmtFormatterStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
118120
| [`pom.SortPomStep`](lib/src/main/java/com/diffplug/spotless/pom/SortPomStep.java) | :white_large_square: | :+1: | :white_large_square: | :white_large_square: |

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ VER_SLF4J=[1.6,2.0[
2626
# Used in multiple places
2727
VER_DURIAN=1.2.0
2828
VER_JGIT=5.13.1.202206130422-r
29-
VER_JUNIT=5.9.1
29+
VER_JUNIT=5.9.2
3030
VER_ASSERTJ=3.24.1
3131
VER_MOCKITO=4.11.0
3232

lib-extra/src/main/java/com/diffplug/spotless/extra/GitRatchet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2022 DiffPlug
2+
* Copyright 2020-2023 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

lib/src/compatKtLint0Dot31Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot31Dot0Adapter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 DiffPlug
2+
* Copyright 2022-2023 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
1515
*/
1616
package com.diffplug.spotless.glue.ktlint.compat;
1717

18+
import java.nio.file.Path;
1819
import java.util.ArrayList;
1920
import java.util.List;
2021
import java.util.Map;
@@ -41,9 +42,9 @@ public Unit invoke(LintError lint, Boolean corrected) {
4142
}
4243

4344
@Override
44-
public String format(final String text, final String name, final boolean isScript,
45+
public String format(final String text, Path path, final boolean isScript,
4546
final boolean useExperimental,
46-
final Map<String, String> userData,
47+
Path editorConfigPath, final Map<String, String> userData,
4748
final Map<String, Object> editorConfigOverrideMap) {
4849
final FormatterCallback formatterCallback = new FormatterCallback();
4950

lib/src/compatKtLint0Dot32Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot32Dot0Adapter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 DiffPlug
2+
* Copyright 2022-2023 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
1515
*/
1616
package com.diffplug.spotless.glue.ktlint.compat;
1717

18+
import java.nio.file.Path;
1819
import java.util.ArrayList;
1920
import java.util.List;
2021
import java.util.Map;
@@ -41,9 +42,9 @@ public Unit invoke(LintError lint, Boolean corrected) {
4142
}
4243

4344
@Override
44-
public String format(final String text, final String name, final boolean isScript,
45+
public String format(final String text, Path path, final boolean isScript,
4546
final boolean useExperimental,
46-
final Map<String, String> userData,
47+
Path editorConfigPath, final Map<String, String> userData,
4748
final Map<String, Object> editorConfigOverrideMap) {
4849
final FormatterCallback formatterCallback = new FormatterCallback();
4950

lib/src/compatKtLint0Dot34Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot34Dot2Adapter.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 DiffPlug
2+
* Copyright 2022-2023 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
1515
*/
1616
package com.diffplug.spotless.glue.ktlint.compat;
1717

18+
import java.nio.file.Path;
1819
import java.util.ArrayList;
1920
import java.util.List;
2021
import java.util.Map;
@@ -41,9 +42,9 @@ public Unit invoke(LintError lint, Boolean corrected) {
4142
}
4243

4344
@Override
44-
public String format(final String text, final String name, final boolean isScript,
45+
public String format(final String text, Path path, final boolean isScript,
4546
final boolean useExperimental,
46-
final Map<String, String> userData,
47+
Path editorConfigPath, final Map<String, String> userData,
4748
final Map<String, Object> editorConfigOverrideMap) {
4849
final FormatterCallback formatterCallback = new FormatterCallback();
4950

@@ -55,13 +56,13 @@ public String format(final String text, final String name, final boolean isScrip
5556
}
5657

5758
return KtLint.INSTANCE.format(new KtLint.Params(
58-
name,
59+
path.toFile().getAbsolutePath(),
5960
text,
6061
rulesets,
6162
userData,
6263
formatterCallback,
6364
isScript,
64-
null,
65+
editorConfigPath == null ? null : editorConfigPath.toFile().getAbsolutePath(),
6566
false));
6667
}
6768
}

0 commit comments

Comments
 (0)