From 722875365bee458028296ea058d27b0c244c4841 Mon Sep 17 00:00:00 2001 From: Mirko Alicastro Date: Sun, 17 May 2026 16:00:43 +0200 Subject: [PATCH 1/3] Avoids recomputing LineEnding.toUnix in Formatter step loop --- lib/src/main/java/com/diffplug/spotless/Formatter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/main/java/com/diffplug/spotless/Formatter.java b/lib/src/main/java/com/diffplug/spotless/Formatter.java index 26f4f61238..71eba72204 100644 --- a/lib/src/main/java/com/diffplug/spotless/Formatter.java +++ b/lib/src/main/java/com/diffplug/spotless/Formatter.java @@ -182,7 +182,7 @@ String computeWithLint(String unix, File file, ValuePerStep exception storeForStep = LintState.formatStepCausedNoChange(); } else { storeForStep = null; - unix = LineEnding.toUnix(formatted); + unix = clean; } } } catch (Throwable e) { From 763468cf202c791fa8b0eab291d6b31b821a77ce Mon Sep 17 00:00:00 2001 From: Mirko Alicastro Date: Sun, 17 May 2026 16:11:56 +0200 Subject: [PATCH 2/3] Updates changelog --- CHANGES.md | 2 ++ plugin-gradle/CHANGES.md | 2 ++ plugin-maven/CHANGES.md | 2 ++ 3 files changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index d2e987fdfd..29485e1583 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Fixed - `LicenseHeaderStep` in `SET_FROM_GIT` year mode no longer invokes `git log` through `bash -c` / `cmd /c`, eliminating a shell-injection vector when processing repositories that contain files whose names include shell metacharacters. +### Changes +- `Formatter` no longer recomputes line-ending normalization (`LineEnding.toUnix`) a second time for every formatter step that changes content, removing redundant O(n) work from the core formatting loop. ([#2934](https://github.com/diffplug/spotless/pull/2934)) ## [4.6.0] - 2026-05-14 ### Added diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index 7cd19d2b6c..6fad800186 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -5,6 +5,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Fixed - `licenseHeader` with `setLicenseHeaderYearsFromGitHistory()` no longer runs `git log` through a shell, eliminating a shell-injection vector when formatting files whose names contain shell metacharacters. +### Changes +- Improved formatting performance by eliminating redundant per-step line-ending normalization in the core formatter loop. ([#2934](https://github.com/diffplug/spotless/pull/2934)) ## [8.5.0] - 2026-05-14 ### Added diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index cc66003859..1b2fd500d1 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -6,6 +6,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ### Fixed - `` with `SET_FROM_GIT` no longer runs `git log` through a shell, eliminating a shell-injection vector when formatting files whose names contain shell metacharacters. - Bump transitive `plexus-utils` `4.0.2` -> `4.0.3` to address [CVE-2025-67030](https://github.com/advisories/GHSA-6fmv-xxpf-w3cw). ([#2919](https://github.com/diffplug/spotless/issues/2919)) +### Changes +- Improved formatting performance by eliminating redundant per-step line-ending normalization in the core formatter loop. ([#2934](https://github.com/diffplug/spotless/pull/2934)) ## [3.5.0] - 2026-05-14 ### Added From cdec412f71a6abd75aa63e7a0703b387080ea8a0 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Mon, 18 May 2026 08:46:34 -0700 Subject: [PATCH 3/3] Move #2934 entries from released sections to [Unreleased] Co-Authored-By: Claude Opus 4.7 (1M context) --- CHANGES.md | 4 ++-- plugin-gradle/CHANGES.md | 4 ++-- plugin-maven/CHANGES.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c7b64b10a7..6d506cd2e2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,12 +10,12 @@ This document is intended for Spotless developers. We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Changes +- `Formatter` no longer recomputes line-ending normalization (`LineEnding.toUnix`) a second time for every formatter step that changes content, removing redundant O(n) work from the core formatting loop. ([#2934](https://github.com/diffplug/spotless/pull/2934)) ## [4.6.1] - 2026-05-15 ### Fixed - `LicenseHeaderStep` in `SET_FROM_GIT` year mode no longer invokes `git log` through `bash -c` / `cmd /c`, eliminating a shell-injection vector when processing repositories that contain files whose names include shell metacharacters. -### Changes -- `Formatter` no longer recomputes line-ending normalization (`LineEnding.toUnix`) a second time for every formatter step that changes content, removing redundant O(n) work from the core formatting loop. ([#2934](https://github.com/diffplug/spotless/pull/2934)) ## [4.6.0] - 2026-05-14 ### Added diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index 889e15b699..4393e93660 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -3,12 +3,12 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`). ## [Unreleased] +### Changes +- Improved formatting performance by eliminating redundant per-step line-ending normalization in the core formatter loop. ([#2934](https://github.com/diffplug/spotless/pull/2934)) ## [8.5.1] - 2026-05-15 ### Fixed - `licenseHeader` with `setLicenseHeaderYearsFromGitHistory()` no longer runs `git log` through a shell, eliminating a shell-injection vector when formatting files whose names contain shell metacharacters. -### Changes -- Improved formatting performance by eliminating redundant per-step line-ending normalization in the core formatter loop. ([#2934](https://github.com/diffplug/spotless/pull/2934)) ## [8.5.0] - 2026-05-14 ### Added diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index ba7cc64694..d090aefe26 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -3,13 +3,13 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Changes +- Improved formatting performance by eliminating redundant per-step line-ending normalization in the core formatter loop. ([#2934](https://github.com/diffplug/spotless/pull/2934)) ## [3.5.1] - 2026-05-15 ### Fixed - `` with `SET_FROM_GIT` no longer runs `git log` through a shell, eliminating a shell-injection vector when formatting files whose names contain shell metacharacters. - Bump transitive `plexus-utils` `4.0.2` -> `4.0.3` to address [CVE-2025-67030](https://github.com/advisories/GHSA-6fmv-xxpf-w3cw). ([#2919](https://github.com/diffplug/spotless/issues/2919)) -### Changes -- Improved formatting performance by eliminating redundant per-step line-ending normalization in the core formatter loop. ([#2934](https://github.com/diffplug/spotless/pull/2934)) ## [3.5.0] - 2026-05-14 ### Added