Skip to content

Commit

Permalink
Add ktlint rule ID in formatter callback exception (#1279)
Browse files Browse the repository at this point in the history
  • Loading branch information
nedtwigg authored Aug 22, 2022
2 parents b535dce + 85e7cd3 commit 99950e7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ 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
* Add the `ktlint` rule in error messages when `ktlint` fails to apply a fix ([#1279](https://github.com/diffplug/spotless/pull/1279))

## [2.28.1] - 2022-08-10
### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ static class FormatterCallback implements Function2<LintError, Boolean, Unit> {
@Override
public Unit invoke(LintError lint, Boolean corrected) {
if (!corrected) {
throw new AssertionError("Error on line: " + lint.getLine() + ", column: " + lint.getCol() + "\n" + lint.getDetail());
throw new AssertionError("Error on line: " + lint.getLine() + ", column: " + lint.getCol() + "\nrule: " + lint.getRuleId() + "\n" + lint.getDetail());
}
return null;
}
Expand Down
2 changes: 2 additions & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `3.27.0`).

## [Unreleased]
### Changes
* Add the `ktlint` rule in error messages when `ktlint` fails to apply a fix ([#1279](https://github.com/diffplug/spotless/pull/1279))

## [6.9.1] - 2022-08-10
### Fixed
Expand Down
2 changes: 2 additions & 0 deletions plugin-maven/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (starting after version `1.27.0`).

## [Unreleased]
### Changes
* Add the `ktlint` rule in error messages when `ktlint` fails to apply a fix ([#1279](https://github.com/diffplug/spotless/pull/1279))

## [2.24.1] - 2022-08-10
### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void behavior() throws Exception {
.testResourceException("kotlin/ktlint/unsolvable.dirty", assertion -> {
assertion.isInstanceOf(AssertionError.class);
assertion.hasMessage("Error on line: 1, column: 1\n" +
"rule: no-wildcard-imports\n" +
"Wildcard import");
});
}
Expand All @@ -44,6 +45,7 @@ void worksPre0_46_1() throws Exception {
.testResourceException("kotlin/ktlint/unsolvable.dirty", assertion -> {
assertion.isInstanceOf(AssertionError.class);
assertion.hasMessage("Error on line: 1, column: 1\n" +
"rule: no-wildcard-imports\n" +
"Wildcard import");
});
}
Expand Down

0 comments on commit 99950e7

Please sign in to comment.