Skip to content

Commit 7673e22

Browse files
committed
Merge branch 'main' of https://github.com/diffplug/spotless into feature/eslint-npm
2 parents d4d91cb + 6865449 commit 7673e22

File tree

13 files changed

+20
-30
lines changed

13 files changed

+20
-30
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

CHANGES.md

Lines changed: 1 addition & 0 deletions
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

Lines changed: 4 additions & 4 deletions
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}} |',
@@ -107,8 +107,8 @@ extra('wtp.EclipseWtpFormatterStep') +'{{yes}} | {{yes}}
107107
| [`java.RemoveUnusedImportsStep`](lib/src/main/java/com/diffplug/spotless/java/RemoveUnusedImportsStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
108108
| [`java.EclipseJdtFormatterStep`](lib-extra/src/main/java/com/diffplug/spotless/extra/java/EclipseJdtFormatterStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
109109
| [`java.FormatAnnotationsStep`](lib/src/main/java/com/diffplug/spotless/java/FormatAnnotationsStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
110-
| [`json.gson.GsonStep`](lib/src/main/java/com/diffplug/spotless/json/gson/GsonStep.java) | :+1: | :white_large_square: | :white_large_square: | :white_large_square: |
111-
| [`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: |
112112
| [`kotlin.KtLintStep`](lib/src/main/java/com/diffplug/spotless/kotlin/KtLintStep.java) | :+1: | :+1: | :+1: | :white_large_square: |
113113
| [`kotlin.KtfmtStep`](lib/src/main/java/com/diffplug/spotless/kotlin/KtfmtStep.java) | :+1: | :+1: | :white_large_square: | :white_large_square: |
114114
| [`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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 15 deletions
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

Lines changed: 2 additions & 1 deletion
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
* Added support for npm-based [ESLint](https://eslint.org/) formatter for javascript and typescript ([#1453](https://github.com/diffplug/spotless/pull/1453))
1011
### Fixed

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

Lines changed: 1 addition & 1 deletion
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

0 commit comments

Comments
 (0)