Skip to content

Commit a2fc77d

Browse files
committed
Merge branch 'main' into renovate/com.diffplug.spotless-6.x
2 parents cdf7c01 + 7667a84 commit a2fc77d

File tree

7 files changed

+51
-9
lines changed

7 files changed

+51
-9
lines changed

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ artifactIdGradle=spotless-plugin-gradle
1717

1818
# Build requirements
1919
VER_JAVA=1.8
20-
VER_SPOTBUGS=4.5.0
20+
VER_SPOTBUGS=4.7.2
2121
VER_JSR_305=3.0.2
2222

2323
# Dependencies provided by Spotless plugin
@@ -26,12 +26,12 @@ 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.0
29+
VER_JUNIT=5.9.1
3030
VER_ASSERTJ=3.23.1
31-
VER_MOCKITO=3.12.4
31+
VER_MOCKITO=4.8.0
3232

3333
# Used for Maven Plugin
3434
VER_MAVEN_API=3.0
35-
VER_ECLIPSE_AETHER=0.9.1.v20140329
35+
VER_ECLIPSE_AETHER=1.1.0
3636
VER_MUSTACHE=0.9.10
3737
VER_PLEXUS_RESOURCES=1.2.0

plugin-maven/CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
44

55
## [Unreleased]
66

7+
## [2.27.1] - 2022-09-28
8+
### Fixed
9+
* `skip` config key should work again now. ([#1353](https://github.com/diffplug/spotless/pull/1353) fixes [#1227](https://github.com/diffplug/spotless/issues/1227) and [#491](https://github.com/diffplug/spotless/issues/491))
10+
11+
## [2.27.0] - 2022-09-19
12+
### Added
13+
* Support for `editorConfigOverride` in `ktlint`, `plugin-maven`. ([#1335](https://github.com/diffplug/spotless/pull/1335) fixes [#1334](https://github.com/diffplug/spotless/issues/1334))
14+
715
## [2.26.0] - 2022-09-14
816
### Added
917
* `formatAnnotations` step to correct formatting of Java type annotations. It puts type annotations on the same line as the type that they qualify. Run it after a Java formatting step, such as `googleJavaFormat`. ([#1275](https://github.com/diffplug/spotless/pull/1275))

plugin-maven/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ output = [
1212
].join('\n');
1313
-->
1414
[![Maven central](https://img.shields.io/badge/mavencentral-com.diffplug.spotless%3Aspotless--maven--plugin-blue.svg)](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.diffplug.spotless%22%20AND%20a%3A%22spotless-maven-plugin%22)
15-
[![Javadoc](https://img.shields.io/badge/javadoc-yes-blue.svg)](https://javadoc.io/doc/com.diffplug.spotless/spotless-maven-plugin/2.26.0/index.html)
16-
[![Changelog](https://img.shields.io/badge/changelog-2.26.0-brightgreen.svg)](CHANGES.md)
15+
[![Javadoc](https://img.shields.io/badge/javadoc-yes-blue.svg)](https://javadoc.io/doc/com.diffplug.spotless/spotless-maven-plugin/2.27.1/index.html)
16+
[![Changelog](https://img.shields.io/badge/changelog-2.27.1-brightgreen.svg)](CHANGES.md)
1717

1818
[![Circle CI](https://circleci.com/gh/diffplug/spotless/tree/main.svg?style=shield)](https://circleci.com/gh/diffplug/spotless/tree/main)
1919
[![Live chat](https://img.shields.io/badge/gitter-chat-brightgreen.svg)](https://gitter.im/diffplug/spotless)
@@ -359,6 +359,10 @@ Groovy-Eclipse formatting errors/warnings lead per default to a build failure. T
359359
```xml
360360
<ktlint>
361361
<version>0.43.2</version> <!-- optional -->
362+
<editorConfigOverride> <!-- optional -->
363+
<ij_kotlin_allow_trailing_comma>true</ij_kotlin_allow_trailing_comma>
364+
<ij_kotlin_allow_trailing_comma_on_call_site>true</ij_kotlin_allow_trailing_comma_on_call_site>
365+
</editorConfigOverride>
362366
</ktlint>
363367
```
364368

plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ public abstract class AbstractSpotlessMojo extends AbstractMojo {
9191
@Parameter(defaultValue = "${mojoExecution.goal}", required = true, readonly = true)
9292
private String goal;
9393

94+
@Parameter(defaultValue = "false")
95+
private boolean skip;
96+
9497
@Parameter(property = "spotless.apply.skip", defaultValue = "false")
9598
private boolean applySkip;
9699

@@ -200,6 +203,10 @@ public final void execute() throws MojoExecutionException {
200203
}
201204

202205
private boolean shouldSkip() {
206+
if (skip) {
207+
return true;
208+
}
209+
203210
switch (goal) {
204211
case GOAL_CHECK:
205212
return checkSkip;
@@ -208,6 +215,7 @@ private boolean shouldSkip() {
208215
default:
209216
break;
210217
}
218+
211219
return false;
212220
}
213221

plugin-maven/src/main/java/com/diffplug/spotless/maven/kotlin/Ktlint.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016 DiffPlug
2+
* Copyright 2016-2022 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,10 @@
1515
*/
1616
package com.diffplug.spotless.maven.kotlin;
1717

18+
import java.util.Collections;
19+
import java.util.HashMap;
20+
import java.util.Map;
21+
1822
import org.apache.maven.plugins.annotations.Parameter;
1923

2024
import com.diffplug.spotless.FormatterStep;
@@ -27,9 +31,17 @@ public class Ktlint implements FormatterStepFactory {
2731
@Parameter
2832
private String version;
2933

34+
@Parameter
35+
private Map<String, Object> editorConfigOverride;
36+
3037
@Override
3138
public FormatterStep newFormatterStep(FormatterStepConfig config) {
3239
String ktlintVersion = version != null ? version : KtLintStep.defaultVersion();
33-
return KtLintStep.create(ktlintVersion, config.getProvisioner());
40+
41+
if (editorConfigOverride == null) {
42+
editorConfigOverride = new HashMap<>();
43+
}
44+
45+
return KtLintStep.create(ktlintVersion, config.getProvisioner(), false, Collections.emptyMap(), editorConfigOverride);
3446
}
3547
}

plugin-maven/src/test/java/com/diffplug/spotless/maven/kotlin/KtlintTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,14 @@ void testKtlint() throws Exception {
2929
mavenRunner().withArguments("spotless:apply").runNoError();
3030
assertFile(path).sameAsResource("kotlin/ktlint/basic.clean");
3131
}
32+
33+
@Test
34+
void testKtlintEditorConfigOverride() throws Exception {
35+
writePomWithKotlinSteps("<ktlint><editorConfigOverride><ij_kotlin_allow_trailing_comma>true</ij_kotlin_allow_trailing_comma><ij_kotlin_allow_trailing_comma_on_call_site>true</ij_kotlin_allow_trailing_comma_on_call_site></editorConfigOverride></ktlint>");
36+
37+
String path = "src/main/kotlin/Main.kt";
38+
setFile(path).toResource("kotlin/ktlint/experimentalEditorConfigOverride.dirty");
39+
mavenRunner().withArguments("spotless:apply").runNoError();
40+
assertFile(path).sameAsResource("kotlin/ktlint/experimentalEditorConfigOverride.clean");
41+
}
3242
}

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pluginManagement {
88
// https://github.com/spotbugs/spotbugs-gradle-plugin/releases
99
id 'com.github.spotbugs' version '5.0.12'
1010
// https://github.com/diffplug/spotless-changelog
11-
id 'com.diffplug.spotless-changelog' version '2.3.2'
11+
id 'com.diffplug.spotless-changelog' version '2.4.0'
1212
// https://github.com/diffplug/goomph/blob/main/CHANGES.md
1313
id 'com.diffplug.p2.asmaven' version '3.27.0' // DO NOT UPDATE, see https://github.com/diffplug/spotless/pull/874
1414
// https://github.com/gradle/test-retry-gradle-plugin/releases

0 commit comments

Comments
 (0)