Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix version regex for black #1178

Merged
merged 3 commits into from
Apr 22, 2022
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
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
6 changes: 4 additions & 2 deletions lib/src/main/java/com/diffplug/spotless/python/BlackStep.java
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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;

Expand All @@ -36,7 +37,7 @@ public static String name() {
}

public static String defaultVersion() {
return "19.10b0";
return "22.3.0";
}

private final String version;
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion plugin-maven/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down