Skip to content
Merged
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
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ 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]
### Added
- Add the ability to specify a wildcard version (`*`) for external formatter executables. ([#2757](https://github.com/diffplug/spotless/issues/2757))
### Changes
* Bump default `ktlint` version to latest `1.7.1` -> `1.8.0`. ([2763](https://github.com/diffplug/spotless/pull/2763))
- Bump default `ktlint` version to latest `1.7.1` -> `1.8.0`. ([2763](https://github.com/diffplug/spotless/pull/2763))

## [4.1.0] - 2025-11-18
### Changes
Expand Down
3 changes: 2 additions & 1 deletion lib/src/main/java/com/diffplug/spotless/ForeignExe.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
public class ForeignExe implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private static final String VERSION_WILDCARD = "*";
private @Nullable String pathToExe;
private String versionFlag = "--version";
private Pattern versionRegex = Pattern.compile("version (\\S*)");
Expand Down Expand Up @@ -111,7 +112,7 @@ public String confirmVersionAndGetAbsolutePath() throws IOException, Interrupted
throw cantFind("Unable to parse version with /" + versionRegex + "/", cmdVersion);
}
String versionFound = versionMatcher.group(1);
if (!versionFound.equals(version)) {
if (!VERSION_WILDCARD.equals(versionFound) && !versionFound.equals(version)) {
throw wrongVersion("You specified version " + version + ", but Spotless found " + versionFound, cmdVersion, versionFound);
}
return exeAbsPath;
Expand Down
4 changes: 3 additions & 1 deletion plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`).

## [Unreleased]
### Added
- Add the ability to specify a wildcard version (`*`) for external formatter executables. ([#2757](https://github.com/diffplug/spotless/issues/2757))
### Changes
* Bump default `ktlint` version to latest `1.7.1` -> `1.8.0`. ([2763](https://github.com/diffplug/spotless/pull/2763))
- Bump default `ktlint` version to latest `1.7.1` -> `1.8.0`. ([2763](https://github.com/diffplug/spotless/pull/2763))

## [8.1.0] - 2025-11-18
### Changes
Expand Down
6 changes: 3 additions & 3 deletions plugin-gradle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ spotless {
[homepage](https://github.com/psf/black). [changelog](https://github.com/psf/black/blob/master/CHANGES.md).

```gradle
black('19.10b0') // version is optional
black('19.10b0') // version is optional. Explicitly allow "any found version" with '*'.

// if black is not on your path, you must specify its location manually
black().pathToExe('C:/myuser/.pyenv/versions/3.8.0/scripts/black.exe')
Expand Down Expand Up @@ -1211,7 +1211,7 @@ When formatting shell scripts via `shfmt`, configure `shfmt` settings via `.edit
Refer to the `shfmt` [man page](https://github.com/mvdan/sh/blob/master/cmd/shfmt/shfmt.1.scd) for `.editorconfig` settings.

```gradle
shfmt('3.8.0') // version is optional
shfmt('3.8.0') // version is optional. Explicitly allow "any found version" with '*'.

// if shfmt is not on your path, you must specify its location manually
shfmt().pathToExe('/opt/homebrew/bin/shfmt')
Expand Down Expand Up @@ -1402,7 +1402,7 @@ spotless {
// you have to set the target manually
target 'src/**/*.cs'

clangFormat('10.0.1') // version is optional
clangFormat('10.0.1') // version is optional. Explicitly allow "any found version" with '*'.

// can also specify a code style
clangFormat().style('LLVM') // or Google, Chromium, Mozilla, WebKit
Expand Down
4 changes: 3 additions & 1 deletion plugin-maven/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`).

## [Unreleased]
### Added
- Add the ability to specify a wildcard version (`*`) for external formatter executables. ([#2757](https://github.com/diffplug/spotless/issues/2757))
### Changes
* Bump default `ktlint` version to latest `1.7.1` -> `1.8.0`. ([2763](https://github.com/diffplug/spotless/pull/2763))
- Bump default `ktlint` version to latest `1.7.1` -> `1.8.0`. ([2763](https://github.com/diffplug/spotless/pull/2763))

## [3.1.0] - 2025-11-18
### Changes
Expand Down
10 changes: 5 additions & 5 deletions plugin-maven/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ Additionally, `editorConfigOverride` options will override what's supplied in `.

```xml
<clangFormat>
<version>14.0.0-1ubuntu1.1</version> <!-- optional version of clang-format -->
<version>14.0.0-1ubuntu1.1</version> <!-- optional version of clang-format. Explicitly allow "any found version" with '*'. -->
<pathToExe>/path/to/buf</pathToExe> <!-- optional: if clang-format isn't in your path -->
<style>LLVM</style> <!-- optional: can be LLVM, Google, Chromium, Mozilla, WebKit -->
</clangFormat>
Expand Down Expand Up @@ -635,7 +635,7 @@ Additionally, `editorConfigOverride` options will override what's supplied in `.

```xml
<black>
<version>19.10b0</version> <!-- optional -->
<version>19.10b0</version> <!-- optional. Explicitly allow "any found version" with '*'. -->
<!-- if black is not on your path, you must specify its location manually -->
<pathToExe>C:/myuser/.pyenv/versions/3.8.0/scripts/black.exe</pathToExe>
<!--
Expand Down Expand Up @@ -1161,7 +1161,7 @@ When formatting shell scripts via `shfmt`, configure `shfmt` settings via `.edit

```xml
<shfmt>
<version>3.8.0</version> <!-- optional: Custom version of 'mvdan/sh' -->
<version>3.8.0</version> <!-- optional: Custom version of 'mvdan/sh'. Explicitly allow "any found version" with '*'. -->
<pathToExe>/opt/homebrew/bin/shfmt</pathToExe> <!-- optional: if shfmt is not on your path, you must specify its location manually -->
</shfmt>
```
Expand Down Expand Up @@ -1216,7 +1216,7 @@ Standard Go formatter, part of Go distribution.

```xml
<gofmt>
<version>go1.25.1</version>
<version>go1.25.1</version> <!-- Explicitly allow "any found version" with '*'. -->
<goExecutablePath>/opt/sdks/go1.25.1/bin/go</goExecutablePath>
</gofmt>
```
Expand Down Expand Up @@ -1303,7 +1303,7 @@ RDF parsing is done via [Apache Jena](https://jena.apache.org/) in the version t
[homepage](https://buf.build/) [buf repo](https://github.com/bufbuild/buf).
```xml
<buf>
<version>1.44.0</version> <!-- optional -->
<version>1.44.0</version> <!-- optional. Explicitly allow "any found version" with '*'. -->
<pathToExe>/path/to/buf</pathToExe> <!-- optional: if buf isn't in your path -->
</buf>
```
Expand Down
Loading