From 3d0a1032397423c46fb46efe1916f2cbb987cfa5 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Thu, 21 Apr 2022 22:20:50 -0700 Subject: [PATCH 1/3] Fix the regex for Python black to work for old and new versions. --- lib/src/main/java/com/diffplug/spotless/python/BlackStep.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/main/java/com/diffplug/spotless/python/BlackStep.java b/lib/src/main/java/com/diffplug/spotless/python/BlackStep.java index c19d023ffc..bd8095c495 100644 --- a/lib/src/main/java/com/diffplug/spotless/python/BlackStep.java +++ b/lib/src/main/java/com/diffplug/spotless/python/BlackStep.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 DiffPlug + * Copyright 2020-2022 DiffPlug * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; +import java.util.regex.Pattern; import javax.annotation.Nullable; @@ -63,6 +64,7 @@ private State createState() throws IOException, InterruptedException { String trackingIssue = "\n github issue to handle this better: https://github.com/diffplug/spotless/issues/674"; String exeAbsPath = ForeignExe.nameAndVersion("black", version) .pathToExe(pathToExe) + .versionRegex(Pattern.compile("(?:black,|version) (\\S*)")) .fixCantFind("Try running {@code pip install black=={version}}, or else tell Spotless where it is with {@code black().pathToExe('path/to/executable')}" + trackingIssue) .fixWrongVersion("Try running {@code pip install --force-reinstall black=={version}}, or else specify {@code black('{versionFound}')} to Spotless" + trackingIssue) .confirmVersionAndGetAbsolutePath(); From 800967a6fbecc2888983e64a66f9e3462714e154 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Thu, 21 Apr 2022 22:22:49 -0700 Subject: [PATCH 2/3] Bump default black version to latest: `19.10b0` -> `22.3.0` --- lib/src/main/java/com/diffplug/spotless/python/BlackStep.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/main/java/com/diffplug/spotless/python/BlackStep.java b/lib/src/main/java/com/diffplug/spotless/python/BlackStep.java index bd8095c495..3f4a8837b6 100644 --- a/lib/src/main/java/com/diffplug/spotless/python/BlackStep.java +++ b/lib/src/main/java/com/diffplug/spotless/python/BlackStep.java @@ -37,7 +37,7 @@ public static String name() { } public static String defaultVersion() { - return "19.10b0"; + return "22.3.0"; } private final String version; From f1c7f3968a78174bd04021ed34af3d225c6c3b71 Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Thu, 21 Apr 2022 22:29:57 -0700 Subject: [PATCH 3/3] Update changelogs. --- CHANGES.md | 3 ++- plugin-gradle/CHANGES.md | 2 ++ plugin-maven/CHANGES.md | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c86189bad4..24ee694274 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,9 +12,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ## [Unreleased] ### Added * Added support for enabling ktlint experimental ruleset. ([#1145](https://github.com/diffplug/spotless/pull/1168)) +### Fixed +* Fixed support for Python Black's new version reporting, and bumped default version to latest (`19.10b0` -> `22.3.0`) ([#1170](https://github.com/diffplug/spotless/issues/1170)) ## [2.24.2] - 2022-04-06 - ### Fixed * Git user config and system config also included for defaultEndings configuration. ([#540](https://github.com/diffplug/spotless/issues/540)) diff --git a/plugin-gradle/CHANGES.md b/plugin-gradle/CHANGES.md index b986f4b839..04d1ccf10f 100644 --- a/plugin-gradle/CHANGES.md +++ b/plugin-gradle/CHANGES.md @@ -6,6 +6,8 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format ( ### Added * Added a runToFixMessage property to customize the run-to-fix message in spotlessCheck task ([#1175](https://github.com/diffplug/spotless/issues/1175)). * Added support for enabling ktlint experimental ruleset. ([#1145](https://github.com/diffplug/spotless/pull/1168)) +### Fixed +* Fixed support for Python Black's new version reporting, and bumped default version to latest (`19.10b0` -> `22.3.0`) ([#1170](https://github.com/diffplug/spotless/issues/1170)) ## [6.4.2] - 2022-04-06 ### Fixed diff --git a/plugin-maven/CHANGES.md b/plugin-maven/CHANGES.md index 7ffcf0cc81..fb5dea1c6d 100644 --- a/plugin-maven/CHANGES.md +++ b/plugin-maven/CHANGES.md @@ -3,9 +3,10 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`). ## [Unreleased] +### Fixed +* Fixed support for Python Black's new version reporting, and bumped default version to latest (`19.10b0` -> `22.3.0`) ([#1170](https://github.com/diffplug/spotless/issues/1170)) ## [2.22.1] - 2022-04-06 - ### Fixed * Git user config and system config also included for defaultEndings configuration. ([#540](https://github.com/diffplug/spotless/issues/540))