Skip to content

Commit

Permalink
fix: maven plugin should identify skip config key (#1353 fixes #1227
Browse files Browse the repository at this point in the history
…and #491)
  • Loading branch information
nedtwigg committed Sep 28, 2022
2 parents f4ee554 + 622f3a0 commit 50e0186
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugin-maven/CHANGES.md
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]
### Fixed
* `skip` config key should work again now. ([#1353](https://github.com/diffplug/spotless/pull/1353) fixes [#1227](https://github.com/diffplug/spotless/issues/1227) and [#491](https://github.com/diffplug/spotless/issues/491))

## [2.27.0] - 2022-09-19
### Added
Expand Down
Expand Up @@ -91,6 +91,9 @@ public abstract class AbstractSpotlessMojo extends AbstractMojo {
@Parameter(defaultValue = "${mojoExecution.goal}", required = true, readonly = true)
private String goal;

@Parameter(defaultValue = "false")
private boolean skip;

@Parameter(property = "spotless.apply.skip", defaultValue = "false")
private boolean applySkip;

Expand Down Expand Up @@ -200,6 +203,10 @@ public final void execute() throws MojoExecutionException {
}

private boolean shouldSkip() {
if (skip) {
return true;
}

switch (goal) {
case GOAL_CHECK:
return checkSkip;
Expand All @@ -208,6 +215,7 @@ private boolean shouldSkip() {
default:
break;
}

return false;
}

Expand Down

0 comments on commit 50e0186

Please sign in to comment.