Skip to content

Commit b8ba6fd

Browse files
author
Vincent Potucek
committed
PoC: Add rewrite support
1 parent acc621e commit b8ba6fd

File tree

5 files changed

+37
-24
lines changed

5 files changed

+37
-24
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ concurrency:
1313
cancel-in-progress: true
1414
jobs:
1515
sanityCheck:
16-
name: spotlessCheck assemble testClasses
16+
name: QA (spotlessCheck, assemble testClasses, rewriteDryRun)
1717
runs-on: ubuntu-latest
1818
env:
1919
buildcacheuser: ${{ secrets.BUILDCACHE_USER }}
@@ -33,6 +33,8 @@ jobs:
3333
run: ./gradlew spotlessCheck
3434
- name: assemble testClasses
3535
run: ./gradlew assemble testClasses
36+
- name: rewriteDryRun
37+
run: ./gradlew rewriteDryRun --build-cache --info
3638
build:
3739
needs: sanityCheck
3840
strategy:
@@ -66,10 +68,10 @@ jobs:
6668
uses: gradle/actions/setup-gradle@v4
6769
- name: build (maven-only)
6870
if: matrix.kind == 'maven'
69-
run: ./gradlew :plugin-maven:build -x spotlessCheck
71+
run: ./gradlew :plugin-maven:build -x spotlessCheck -x rewriteDryRun
7072
- name: build (everything-but-maven)
7173
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
7375
- name: test npm
7476
if: matrix.kind == 'npm'
7577
run: ./gradlew testNpm

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
1616
* Adds support for worktrees (fixes [#1765](https://github.com/diffplug/spotless/issues/1765))
1717
* Bump default `google-java-format` version to latest `1.24.0` -> `1.28.0`. ([#2345](https://github.com/diffplug/spotless/pull/2345))
1818
* Bump default `ktlint` version to latest `1.5.0` -> `1.7.1`. ([#2555](https://github.com/diffplug/spotless/pull/2555))
19+
* PoC: Add `rewrite` support for `errorprone.refasterrules` ([#2576](https://github.com/diffplug/spotless/pull/2576))
1920

2021
## [3.3.1] - 2025-07-21
2122
### Fixed

build.gradle

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,16 @@
11
apply plugin: 'dev.equo.ide'
2-
equoIde {
3-
branding().title('Spotless').icon(file('_images/spotless_logo.png'))
4-
welcome().openUrl('https://github.com/diffplug/spotless/blob/main/CONTRIBUTING.md')
5-
gradleBuildship().autoImport('.')
6-
}
7-
8-
repositories {
9-
mavenCentral()
10-
}
112

12-
apply from: rootProject.file('gradle/java-publish.gradle')
133
apply from: rootProject.file('gradle/changelog.gradle')
4+
apply from: rootProject.file('gradle/java-publish.gradle')
5+
apply from: rootProject.file('gradle/spotless-freshmark.gradle')
6+
147
allprojects {
158
apply from: rootProject.file('gradle/spotless.gradle')
9+
apply from: rootProject.file('gradle/rewrite.gradle')
1610
}
17-
apply from: rootProject.file('gradle/spotless-freshmark.gradle')
1811

19-
spotless {
20-
groovyGradle {
21-
target '*.gradle', 'gradle/*.gradle'
22-
}
23-
format 'dotfiles', {
24-
target '.gitignore', '.gitattributes', '.editorconfig'
25-
leadingTabsToSpaces(2)
26-
trimTrailingWhitespace()
27-
endWithNewline()
28-
}
12+
equoIde {
13+
branding().title('Spotless').icon(file('_images/spotless_logo.png'))
14+
welcome().openUrl('https://github.com/diffplug/spotless/blob/main/CONTRIBUTING.md')
15+
gradleBuildship().autoImport('.')
2916
}

gradle/rewrite.gradle

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apply plugin: 'org.openrewrite.rewrite'
2+
3+
rewrite {
4+
//activeRecipe("org.openrewrite.java.RemoveUnusedImports")
5+
// bugs
6+
exclusions.add("**AJacksonFormatterFunc.java")
7+
exclusions.add("**NpmPathResolver.java")
8+
exclusions.add("**NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_*.gradle")
9+
exclusions.add("**gradle/changelog.gradle")
10+
exclusions.add("**gradle/java-publish.gradle")
11+
exclusions.add("**lib-extra/build.gradle")
12+
exclusions.add("**lib/build.gradle")
13+
exclusions.add("**package-info.java")
14+
exclusions.add("**plugin-maven/build.gradle")
15+
exclusions.add("**settings.gradle")
16+
exportDatatables = true
17+
failOnDryRunResults = true
18+
}
19+
20+
dependencies {
21+
rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:latest.release"))
22+
}

settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ plugins {
2323
id 'com.gradle.develocity' version '3.19.2'
2424
// https://github.com/equodev/equo-ide/blob/main/plugin-gradle/CHANGELOG.md
2525
id 'dev.equo.ide' version '1.7.8' apply false
26+
id 'org.openrewrite.rewrite' version '7.12.1' apply false
2627
}
2728

2829
dependencyResolutionManagement {

0 commit comments

Comments
 (0)