File tree Expand file tree Collapse file tree 8 files changed +29
-15
lines changed
lib/src/main/java/com/diffplug/spotless/npm
plugin-maven/src/main/java/com/diffplug/spotless/maven Expand file tree Collapse file tree 8 files changed +29
-15
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ concurrency:
13
13
cancel-in-progress : true
14
14
jobs :
15
15
sanityCheck :
16
- name : spotlessCheck assemble testClasses
16
+ name : spotlessCheck rewriteDryRun assemble testClasses
17
17
runs-on : ubuntu-latest
18
18
env :
19
19
buildcacheuser : ${{ secrets.BUILDCACHE_USER }}
31
31
uses : gradle/actions/setup-gradle@v4
32
32
- name : spotlessCheck
33
33
run : ./gradlew spotlessCheck
34
+ - name : rewriteDryRun
35
+ run : ./gradlew rewriteDryRun
34
36
- name : assemble testClasses
35
37
run : ./gradlew assemble testClasses
36
38
build :
@@ -66,10 +68,10 @@ jobs:
66
68
uses : gradle/actions/setup-gradle@v4
67
69
- name : build (maven-only)
68
70
if : matrix.kind == 'maven'
69
- run : ./gradlew :plugin-maven:build -x spotlessCheck
71
+ run : ./gradlew :plugin-maven:build -x spotlessCheck -x rewriteDryRun
70
72
- name : build (everything-but-maven)
71
73
if : matrix.kind == 'gradle'
72
- run : ./gradlew build -x spotlessCheck -PSPOTLESS_EXCLUDE_MAVEN=true
74
+ run : ./gradlew build -x spotlessCheck -x rewriteDryRun - PSPOTLESS_EXCLUDE_MAVEN=true
73
75
- name : test npm
74
76
if : matrix.kind == 'npm'
75
77
run : ./gradlew testNpm
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
27
27
### Added
28
28
* Add a ` lint ` mode to ` ReplaceRegexStep ` ([ #2571 ] ( https://github.com/diffplug/spotless/pull/2571 ) )
29
29
* ` LintSuppression ` now enforces unix-style paths in its ` setPath ` and ` relativizeAsUnix ` methods. ([ #2629 ] ( https://github.com/diffplug/spotless/pull/2629 ) )
30
+ * Add ` rewrite ` support ([ #2588 ] ( https://github.com/diffplug/spotless/pull/2588 ) )
30
31
31
32
## [ 3.3.1] - 2025-07-21
32
33
### Fixed
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ repositories {
12
12
apply from : rootProject. file(' gradle/java-publish.gradle' )
13
13
apply from : rootProject. file(' gradle/changelog.gradle' )
14
14
allprojects {
15
+ apply from : rootProject. file(' gradle/rewrite.gradle' )
15
16
apply from : rootProject. file(' gradle/spotless.gradle' )
16
17
}
17
18
apply from : rootProject. file(' gradle/spotless-freshmark.gradle' )
@@ -27,3 +28,7 @@ spotless {
27
28
endWithNewline()
28
29
}
29
30
}
31
+
32
+ dependencies {
33
+ rewrite(" org.openrewrite.recipe:rewrite-third-party:0.27.0" )
34
+ }
Original file line number Diff line number Diff line change
1
+ apply plugin : ' org.openrewrite.rewrite'
2
+
3
+ rewrite {
4
+ activeRecipe(" tech.picnic.errorprone.refasterrules.StreamRulesRecipes" )
5
+ exportDatatables = true
6
+ failOnDryRunResults = true
7
+ }
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2020-2023 DiffPlug
2
+ * Copyright 2020-2025 DiffPlug
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
18
18
import static java .util .Objects .requireNonNull ;
19
19
20
20
import java .io .File ;
21
- import java .util .*;
21
+ import java .util .ArrayList ;
22
+ import java .util .Arrays ;
23
+ import java .util .List ;
24
+ import java .util .Optional ;
22
25
import java .util .function .Function ;
23
26
import java .util .function .Predicate ;
24
27
import java .util .function .Supplier ;
@@ -44,8 +47,8 @@ Optional<File> tryFind() {
44
47
.stream ()
45
48
.map (Supplier ::get )
46
49
.filter (Optional ::isPresent )
47
- .map ( Optional :: get )
48
- .findFirst ( );
50
+ .findFirst ( )
51
+ .map ( Optional :: get );
49
52
}
50
53
51
54
static class Builder {
Original file line number Diff line number Diff line change @@ -81,11 +81,7 @@ public boolean isLayoutPrepared() {
81
81
if (!packageLockJsonFile .isFile ()) {
82
82
return false ;
83
83
}
84
- if (!serveJsFile ().isFile ()) {
85
- return false ;
86
- }
87
- // npmrc is optional, so must not be checked here
88
- return true ;
84
+ return serveJsFile ().isFile (); // npmrc is optional, so must not be checked here
89
85
}
90
86
91
87
public boolean isNodeModulesPrepared () {
@@ -96,7 +92,7 @@ public boolean isNodeModulesPrepared() {
96
92
// check if it is NOT empty
97
93
return ThrowingEx .get (() -> {
98
94
try (Stream <Path > entries = Files .list (nodeModulesInstallDirPath )) {
99
- return entries .findFirst ().isPresent ();
95
+ return entries .findAny ().isPresent ();
100
96
}
101
97
});
102
98
}
Original file line number Diff line number Diff line change @@ -414,8 +414,7 @@ private List<FormatterFactory> getFormatterFactories() {
414
414
}
415
415
416
416
private List <FormatterStepFactory > getFormatterStepFactories () {
417
- return Stream .of (licenseHeader )
418
- .filter (Objects ::nonNull )
417
+ return Stream .ofNullable (licenseHeader )
419
418
.collect (toList ());
420
419
}
421
420
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ plugins {
23
23
id ' com.gradle.develocity' version ' 3.19.2'
24
24
// https://github.com/equodev/equo-ide/blob/main/plugin-gradle/CHANGELOG.md
25
25
id ' dev.equo.ide' version ' 1.7.8' apply false
26
+ id ' org.openrewrite.rewrite' version ' 7.16.0' apply false
26
27
}
27
28
28
29
dependencyResolutionManagement {
You can’t perform that action at this time.
0 commit comments