Skip to content

Commit 13f10ca

Browse files
authoredJan 9, 2023
Fixup readme and changelog for the maven json integration (amend #1446 via #1473 and #1474)
2 parents 4ee53aa + 77b77f7 commit 13f10ca

File tree

11 files changed

+18
-30
lines changed

11 files changed

+18
-30
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
### Added
1414
* 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`.
1516
* 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)).
1617
### Fixed
1718
* 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))

‎README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ 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}} |',
@@ -106,8 +106,8 @@ extra('wtp.EclipseWtpFormatterStep') +'{{yes}} | {{yes}}
106106
| [`java.RemoveUnusedImportsStep`](lib/src/main/java/com/diffplug/spotless/java/RemoveUnusedImportsStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
107107
| [`java.EclipseJdtFormatterStep`](lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
108108
| [`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: |
109+
| [`json.gson.GsonStep`](lib/src/main/java/com/diffplug/spotless/json/gson/GsonStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
110+
| [`json.JsonSimpleStep`](lib/src/main/java/com/diffplug/spotless/json/JsonSimpleStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
111111
| [`kotlin.KtLintStep`](lib/src/main/java/com/diffplug/spotless/kotlin/KtLintStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
112112
| [`kotlin.KtfmtStep`](lib/src/main/java/com/diffplug/spotless/kotlin/KtfmtStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
113113
| [`kotlin.DiktatStep`](lib/src/main/java/com/diffplug/spotless/kotlin/DiktatStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public String format(final String text, Path path, final boolean isScript,
6262
userData,
6363
formatterCallback,
6464
isScript,
65-
editorConfigPath.toFile().getAbsolutePath(),
65+
editorConfigPath == null ? null : editorConfigPath.toFile().getAbsolutePath(),
6666
false));
6767
}
6868
}

‎lib/src/compatKtLint0Dot45Dot2/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot45Dot2Adapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public String format(final String text, Path path, final boolean isScript,
7777
userData,
7878
formatterCallback,
7979
isScript,
80-
editorConfigPath.toFile().getAbsolutePath(),
80+
editorConfigPath == null ? null : editorConfigPath.toFile().getAbsolutePath(),
8181
false,
8282
editorConfigOverride,
8383
false));

‎lib/src/compatKtLint0Dot46Dot0/java/com/diffplug/spotless/glue/ktlint/compat/KtLintCompat0Dot46Dot0Adapter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public String format(final String text, Path path, final boolean isScript,
7777
userData,
7878
formatterCallback,
7979
isScript,
80-
editorConfigPath.toFile().getAbsolutePath(),
80+
editorConfigPath == null ? null : editorConfigPath.toFile().getAbsolutePath(),
8181
false,
8282
editorConfigOverride,
8383
false));

‎lib/src/main/java/com/diffplug/spotless/kotlin/KtLintStep.java

-15
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,6 @@ public static FormatterStep createForScript(String version,
7575
editorConfigOverride);
7676
}
7777

78-
private static FormatterStep create(String version,
79-
Provisioner provisioner,
80-
boolean isScript,
81-
boolean useExperimental,
82-
Map<String, String> userData,
83-
Map<String, Object> editorConfigOverride) {
84-
return create(version,
85-
provisioner,
86-
useExperimental,
87-
isScript,
88-
null,
89-
userData,
90-
editorConfigOverride);
91-
}
92-
9378
public static FormatterStep create(String version,
9479
Provisioner provisioner,
9580
boolean isScript,

‎plugin-gradle/CHANGES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
44

55
## [Unreleased]
66
### Added
7-
* Add option `editorConfigFile` for `ktLint` [#142](https://github.com/diffplug/spotless/issues/142)
7+
* **POTENTIALLY BREAKING** `ktlint` step now supports `.editorconfig` ([#1442](https://github.com/diffplug/spotless/pull/1442) implements [#142](https://github.com/diffplug/spotless/issues/142))
8+
* **POTENTIALLY BREAKING** `ktlint` step now modifies license headers. Make sure to put `licenseHeader` *after* `ktlint`.
89
* 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))
910
### Fixed
1011
* Prevent tool configurations from being resolved outside project ([#1447](https://github.com/diffplug/spotless/pull/1447) fixes [#1215](https://github.com/diffplug/spotless/issues/1215))

‎plugin-gradle/src/main/java/com/diffplug/gradle/spotless/KotlinExtension.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public LicenseHeaderConfig licenseHeaderFile(Object licenseHeaderFile) {
6363
public KotlinFormatExtension ktlint(String version) throws IOException {
6464
Objects.requireNonNull(version);
6565
File defaultEditorConfig = getProject().getRootProject().file(".editorconfig");
66-
FileSignature editorConfigPath = FileSignature.signAsList(defaultEditorConfig);
66+
FileSignature editorConfigPath = defaultEditorConfig.exists() ? FileSignature.signAsList(defaultEditorConfig) : null;
6767
return new KotlinFormatExtension(version, false, editorConfigPath, Collections.emptyMap(), Collections.emptyMap());
6868
}
6969

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public KotlinGradleExtension(SpotlessExtension spotless) {
4848
public KotlinFormatExtension ktlint(String version) throws IOException {
4949
Objects.requireNonNull(version, "version");
5050
File defaultEditorConfig = getProject().getRootProject().file(".editorconfig");
51-
FileSignature editorConfigPath = FileSignature.signAsList(defaultEditorConfig);
51+
FileSignature editorConfigPath = defaultEditorConfig.exists() ? FileSignature.signAsList(defaultEditorConfig) : null;
5252
return new KotlinFormatExtension(version, false, editorConfigPath, Collections.emptyMap(), Collections.emptyMap());
5353
}
5454

‎plugin-gradle/src/test/java/com/diffplug/gradle/spotless/KotlinExtensionTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2022 DiffPlug
2+
* Copyright 2016-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.
@@ -187,8 +187,8 @@ void testWithHeader() throws IOException {
187187
"repositories { mavenCentral() }",
188188
"spotless {",
189189
" kotlin {",
190-
" licenseHeader('" + HEADER + "')",
191190
" ktlint()",
191+
" licenseHeader('" + HEADER + "')",
192192
" }",
193193
"}");
194194
setFile("src/main/kotlin/AnObject.kt").toResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
@@ -226,8 +226,8 @@ void testWithCustomHeaderSeparator() throws IOException {
226226
"repositories { mavenCentral() }",
227227
"spotless {",
228228
" kotlin {",
229-
" licenseHeader ('" + HEADER + "', '@file')",
230229
" ktlint()",
230+
" licenseHeader ('" + HEADER + "', '@file')",
231231
" }",
232232
"}");
233233
setFile("src/main/kotlin/AnObject.kt").toResource("kotlin/licenseheader/KotlinCodeWithoutHeader.test");
@@ -265,8 +265,8 @@ void testWithNonStandardYearSeparator() throws IOException {
265265
"repositories { mavenCentral() }",
266266
"spotless {",
267267
" kotlin {",
268-
" licenseHeader('" + HEADER_WITH_YEAR + "').yearSeparator(', ')",
269268
" ktlint()",
269+
" licenseHeader('" + HEADER_WITH_YEAR + "').yearSeparator(', ')",
270270
" }",
271271
"}");
272272

‎plugin-maven/CHANGES.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
55
## [Unreleased]
66
### Added
77
* Add option `editorConfigFile` for `ktLint` [#142](https://github.com/diffplug/spotless/issues/142)
8+
* **POTENTIALLY BREAKING** `ktlint` step now modifies license headers. Make sure to put `licenseHeader` *after* `ktlint`.
89
* 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))
10+
* Add JSON support ([#1446](https://github.com/diffplug/spotless/pull/1446))
911
### Fixed
1012
* 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))
1113
### Changes
@@ -15,7 +17,6 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1517
## [2.29.0] - 2023-01-02
1618
### Added
1719
* Added support for M2E's incremental compilation ([#1414](https://github.com/diffplug/spotless/pull/1414) fixes [#1413](https://github.com/diffplug/spotless/issues/1413))
18-
* Add JSON support ([#1446](https://github.com/diffplug/spotless/pull/1446))
1920
### Fixed
2021
* Improve memory usage when using git ratchet ([#1426](https://github.com/diffplug/spotless/pull/1426))
2122
* Support `ktlint` 0.48+ ([#1432](https://github.com/diffplug/spotless/pull/1432)) fixes ([#1430](https://github.com/diffplug/spotless/issues/1430))

0 commit comments

Comments
 (0)
Please sign in to comment.