Skip to content

obsolete - Add support for linters #1097

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

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d5b0421
Define a `Lint`.
nedtwigg Jan 12, 2022
db676fc
Add a `lint` method to `FormatterStep` and let it wripple through.
nedtwigg Jan 12, 2022
5dc6271
Make Lint roundtrippable through a String.
nedtwigg Jan 13, 2022
cc71751
Formatter.lint
nedtwigg Jan 13, 2022
aac3972
Lint ripples through DirtyState and Formatter.
nedtwigg Jan 13, 2022
a25eded
SpotlessTaskImpl now generates both a formatted result and a lint res…
nedtwigg Jan 13, 2022
89339cd
SpotlessTaskImpl now generates a lint result for `check` and for `app…
nedtwigg Jan 14, 2022
cac4f70
Gradle spotlessCheck will now throw an error if all of the files are …
nedtwigg Jan 14, 2022
d4ec76b
Maven spotless:check will now throw an error if all of the files are …
nedtwigg Jan 14, 2022
7a1e72a
Default `FormatterFunc.lint` now traps errors from the formatter itse…
nedtwigg Jan 14, 2022
109c7fb
Remove `FormatExceptionPolicy`.
nedtwigg Jan 14, 2022
0049661
Remove `FormatExceptionPolicy` from the maven plugin.
nedtwigg Jan 14, 2022
dd5165f
Replace `FormatExceptionPolicy` with `LintPolicy` inside the Gradle p…
nedtwigg Jan 14, 2022
85fbe71
Lint.toFile might need to create parent directories.
nedtwigg Jan 14, 2022
e8e5df5
Lints are now quietly suppressed during `apply`, you have to do `chec…
nedtwigg Jan 14, 2022
6ec06cc
Fix spotbugs warnings.
nedtwigg Jan 14, 2022
9557c66
Fix the bug I made from fixing spotbugs :)
nedtwigg Jan 14, 2022
2844068
Make sure that FormatterFunc.Closeable's helpers support linting.
nedtwigg Jan 14, 2022
9134d8c
Fix FormatterFunc.Closeable earlier
nedtwigg Jan 14, 2022
5a9799d
Refactor PipeStepPair so that it can detect lost tags within our new …
nedtwigg Jan 14, 2022
07b39cb
Rename PipeStepPair to FenceStep.
nedtwigg Jan 14, 2022
78ddcd6
Removed `rootDir` property `Formatter` and its builder because it was…
nedtwigg Jan 14, 2022
f947c7b
`DiffMessageFormatter.Builder::formatter` needs a new `Path rootDir` …
nedtwigg Jan 14, 2022
a3eef1f
Adapt StepHarness for the new "exceptions never get thrown" environment.
nedtwigg Jan 15, 2022
3f72b7e
When a step throws an exception, we now accurately consider the entir…
nedtwigg Jan 14, 2022
1ed3149
Fix tests.
nedtwigg Jan 15, 2022
6e38887
Fix spotbugs.
nedtwigg Jan 15, 2022
eb0feed
Fix wrong SuppressFBWarnings import.
nedtwigg Jan 15, 2022
248ec28
Fix tests on windows.
nedtwigg Jan 15, 2022
3aa780e
Fix prettier error test.
nedtwigg Jan 15, 2022
e110426
Make our testing parallel.
nedtwigg Jan 15, 2022
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
Prev Previous commit
Next Next commit
DiffMessageFormatter.Builder::formatter needs a new Path rootDir
…parameter.
  • Loading branch information
nedtwigg committed Jan 14, 2022
commit f947c7bb19edeaef39f83b8dc162d1be0bb483f9
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
* **BREAKING** Renamed `PipeStepPair` to `FenceStep` and changed its API.
* The old "pair" approach could not detect when a `spotless:off/on` tag pair was removed by an intermediate step, so we have no choice but to condense the "in/(all other steps)/out" into a single step.
* **BREAKING** Removed `rootDir` property `Formatter` and its builder because it was only used to annnotate errors, which is now done by the lint phase.
* This also means that `DiffMessageFormatter.Builder::formatter` needs a new `Path rootDir` parameter.
* **BREAKING** Removed deprecated methods.
* `FormatterFunc.Closeable::of(AutoCloseable, FormatterFunc)`

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2021 DiffPlug
* Copyright 2016-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 Down Expand Up @@ -57,14 +57,16 @@ interface CleanProvider {

private static class CleanProviderFormatter implements CleanProvider {
private final Formatter formatter;
private final Path rootDir;

CleanProviderFormatter(Formatter formatter) {
CleanProviderFormatter(Path rootDir, Formatter formatter) {
this.rootDir = rootDir;
this.formatter = Objects.requireNonNull(formatter);
}

@Override
public Path getRootDir() {
return formatter.getRootDir();
return rootDir;
}

@Override
Expand Down Expand Up @@ -121,8 +123,8 @@ public Builder runToFix(String runToFix) {
return this;
}

public Builder formatter(Formatter formatter) {
this.formatter = new CleanProviderFormatter(formatter);
public Builder formatter(Path rootDir, Formatter formatter) {
this.formatter = new CleanProviderFormatter(rootDir, formatter);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public abstract class AbstractSpotlessMojo extends AbstractMojo {
private List<RemoteRepository> repositories;

@Parameter(defaultValue = "${project.basedir}", required = true, readonly = true)
private File baseDir;
protected File baseDir;

@Parameter(defaultValue = "${project.build.directory}", required = true, readonly = true)
private File buildDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void process(Iterable<File> files, Formatter formatter, UpToDateChecke
if (!problemFiles.isEmpty()) {
throw new MojoExecutionException(DiffMessageFormatter.builder()
.runToFix("Run 'mvn spotless:apply' to fix these violations.")
.formatter(formatter)
.formatter(baseDir.toPath(), formatter)
.problemFiles(problemFiles)
.getMessage());
}
Expand Down