Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true
jobs:
sanityCheck:
name: spotlessCheck assemble testClasses
name: spotlessCheck rewriteDryRun assemble testClasses
runs-on: ubuntu-latest
env:
buildcacheuser: ${{ secrets.BUILDCACHE_USER }}
Expand All @@ -31,6 +31,8 @@ jobs:
uses: gradle/actions/setup-gradle@v4
- name: spotlessCheck
run: ./gradlew spotlessCheck
- name: rewriteDryRun
run: ./gradlew rewriteDryRun
- name: assemble testClasses
run: ./gradlew assemble testClasses
build:
Expand Down Expand Up @@ -66,10 +68,10 @@ jobs:
uses: gradle/actions/setup-gradle@v4
- name: build (maven-only)
if: matrix.kind == 'maven'
run: ./gradlew :plugin-maven:build -x spotlessCheck
run: ./gradlew :plugin-maven:build -x spotlessCheck -x rewriteDryRun
- name: build (everything-but-maven)
if: matrix.kind == 'gradle'
run: ./gradlew build -x spotlessCheck -PSPOTLESS_EXCLUDE_MAVEN=true
run: ./gradlew build -x spotlessCheck -x rewriteDryRun -PSPOTLESS_EXCLUDE_MAVEN=true
- name: test npm
if: matrix.kind == 'npm'
run: ./gradlew testNpm
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
### Added
* Add a `lint` mode to `ReplaceRegexStep` ([#2571](https://github.com/diffplug/spotless/pull/2571))
* `LintSuppression` now enforces unix-style paths in its `setPath` and `relativizeAsUnix` methods. ([#2629](https://github.com/diffplug/spotless/pull/2629))
* Issue #2634: Add `StreamRulesRecipes` ([#2588](https://github.com/diffplug/spotless/pull/2588))

## [3.3.1] - 2025-07-21
### Fixed
Expand Down
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ repositories {
apply from: rootProject.file('gradle/java-publish.gradle')
apply from: rootProject.file('gradle/changelog.gradle')
allprojects {
apply from: rootProject.file('gradle/rewrite.gradle')
apply from: rootProject.file('gradle/spotless.gradle')
}
apply from: rootProject.file('gradle/spotless-freshmark.gradle')
Expand All @@ -27,3 +28,7 @@ spotless {
endWithNewline()
}
}

dependencies {
rewrite("org.openrewrite.recipe:rewrite-third-party:0.27.0")
}
7 changes: 7 additions & 0 deletions gradle/rewrite.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apply plugin: 'org.openrewrite.rewrite'

rewrite {
activeRecipe("tech.picnic.errorprone.refasterrules.StreamRulesRecipes")
exportDatatables = true
failOnDryRunResults = true
}
11 changes: 7 additions & 4 deletions lib/src/main/java/com/diffplug/spotless/npm/FileFinder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2023 DiffPlug
* Copyright 2020-2025 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,10 @@
import static java.util.Objects.requireNonNull;

import java.io.File;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
Expand All @@ -44,8 +47,8 @@ Optional<File> tryFind() {
.stream()
.map(Supplier::get)
.filter(Optional::isPresent)
.map(Optional::get)
.findFirst();
.findFirst()
.map(Optional::get);
}

static class Builder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,7 @@ public boolean isLayoutPrepared() {
if (!packageLockJsonFile.isFile()) {
return false;
}
if (!serveJsFile().isFile()) {
return false;
}
// npmrc is optional, so must not be checked here
return true;
return serveJsFile().isFile(); // npmrc is optional, so must not be checked here
}

public boolean isNodeModulesPrepared() {
Expand All @@ -96,7 +92,7 @@ public boolean isNodeModulesPrepared() {
// check if it is NOT empty
return ThrowingEx.get(() -> {
try (Stream<Path> entries = Files.list(nodeModulesInstallDirPath)) {
return entries.findFirst().isPresent();
return entries.findAny().isPresent();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ private List<FormatterFactory> getFormatterFactories() {
}

private List<FormatterStepFactory> getFormatterStepFactories() {
return Stream.of(licenseHeader)
.filter(Objects::nonNull)
return Stream.ofNullable(licenseHeader)
.collect(toList());
}

Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ plugins {
id 'com.gradle.develocity' version '3.19.2'
// https://github.com/equodev/equo-ide/blob/main/plugin-gradle/CHANGELOG.md
id 'dev.equo.ide' version '1.7.8' apply false
id 'org.openrewrite.rewrite' version '7.16.0' apply false
}

dependencyResolutionManagement {
Expand Down
Loading