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

Linting - API #2149

Merged
merged 35 commits into from
Oct 21, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9afa6dd
Handy tool for making encoding formats that don't have any forbidden …
nedtwigg May 30, 2024
319fc79
Revert "Handy tool for making encoding formats that don't have any fo…
nedtwigg May 30, 2024
777fd5c
Add a `Lint` class, along with `ShortcutException` for sending them.
nedtwigg May 30, 2024
322d5bf
Add a `lint` method to the core interfaces: `Formatter[Step|Func]`
nedtwigg May 30, 2024
c9f52d5
Pipe linting through the core FormatterStep implementations.
nedtwigg May 30, 2024
b57bf24
Formatter can now capture exceptions per-formatter, rethrows if you d…
nedtwigg May 30, 2024
a94dce9
Pipe the lints through `FenceStep`, preliminary.
nedtwigg May 30, 2024
c224929
Remove all of `FormatExceptionPolicy` except `Strict`, which remains …
nedtwigg May 30, 2024
b01e9e9
Rename `ExceptionPerStep` to `ValuePerStep`, and bring `Formatter` cl…
nedtwigg May 30, 2024
fe92d05
Update `Formatter` and `ValuePerStep` so that something (perhaps null…
nedtwigg May 31, 2024
f3be100
Introduce LintState which efficiently reads lint data from both `form…
nedtwigg May 31, 2024
5c42457
Restore the "legacy" error printing for both `Formatter` and `DirtySt…
nedtwigg May 31, 2024
d467545
Fix spotbugs.
nedtwigg May 31, 2024
700114f
Add Selfie, and configure it to not use triple quote literals.
nedtwigg Jun 4, 2024
ffc911e
Add a way to test for lints, and use that to bring back FenceStepTest…
nedtwigg Jun 4, 2024
c2fe9c6
Merge branch 'feat/prepare-for-lint-take-2' into feat/lint-take-2
nedtwigg Jun 4, 2024
6bbe556
Deal with `DirtyState.Calculation` is gone.
nedtwigg Jun 4, 2024
aa769d0
Merge branch 'feat/prepare-for-lint-take-2' into feat/lint-take-2
nedtwigg Oct 15, 2024
d08f442
Two maven tests which fail because errors are getting swallowed as li…
nedtwigg Oct 16, 2024
53e31f5
Some gradle tests which fail because errors are getting swallowed as …
nedtwigg Oct 16, 2024
9af4880
DirtyState now uses `LintPolicy.legacyBehavior` unless you passed in …
nedtwigg Oct 16, 2024
dfca397
Rework SpotlessTask to use `LintState` so that we can know which step…
nedtwigg Oct 17, 2024
29cba64
We don't need to move lints to their own place *yet*.
nedtwigg Oct 17, 2024
43cd94b
Make an explicit constant for a lint at an undefined line.
nedtwigg Oct 17, 2024
7bf6b1b
Merge branch 'main' into feat/lint-take-2
nedtwigg Oct 17, 2024
6619a76
Fix windows.
nedtwigg Oct 17, 2024
a9bd0a6
Update changelog.
nedtwigg Oct 17, 2024
6c480d8
Add info to CONTRIBUTING
nedtwigg Oct 17, 2024
2fb5a16
Merge branch 'main' into feat/lint-take-2
nedtwigg Oct 17, 2024
ae31ea5
Setup selfie.
nedtwigg Oct 20, 2024
8300fda
Fix ambiguities in the `Lint` class around treating it as data vs exc…
nedtwigg Oct 20, 2024
9658d41
Improve LintState's toString.
nedtwigg Oct 20, 2024
d00a4ab
Adapt gradle test for the API.
nedtwigg Oct 20, 2024
195bc16
Remove `testResourceExceptionMsg` and replace with `expectLintsOfReso…
nedtwigg Oct 20, 2024
14cbc52
Merge branch 'main' into feat/lint-take-2
nedtwigg Oct 20, 2024
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
Merge branch 'feat/prepare-for-lint-take-2' into feat/lint-take-2
  • Loading branch information
nedtwigg committed Oct 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit aa769d099dff52a6c698457d1642bfc19f90a3a8
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -28,8 +28,8 @@ VER_SLF4J=[1.6,2.0[

# Used in multiple places
VER_DURIAN=1.2.0
VER_JGIT=6.7.0.202309050840-r
VER_JUNIT=5.10.2
VER_ASSERTJ=3.26.0
VER_MOCKITO=5.12.0
VER_SELFIE=2.2.0
VER_JGIT=6.10.0.202406032230-r
VER_JUNIT=5.11.2
VER_ASSERTJ=3.26.3
VER_MOCKITO=5.14.2
VER_SELFIE=2.4.1
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.work.Incremental;

import com.diffplug.spotless.ConfigurationCacheHackList;
import com.diffplug.spotless.FormatExceptionPolicyStrict;
import com.diffplug.spotless.Formatter;
import com.diffplug.spotless.FormatterStep;
Original file line number Diff line number Diff line change
@@ -19,8 +19,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.IOException;

import org.junit.jupiter.api.Test;
import org.owasp.encoder.Encode;

@@ -389,7 +387,7 @@
"}");
setFile("biome_test.js").toResource("biome/js/fileBefore.js");

var spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").buildAndFail();

Check failure on line 390 in plugin-gradle/src/test/java/com/diffplug/gradle/spotless/BiomeIntegrationTest.java

GitHub Actions / JUnit gradle 22 ubuntu-latest

BiomeIntegrationTest.failureWhenNotParseable()

org.gradle.testkit.runner.UnexpectedBuildSuccess: Unexpected build execution success in /tmp/junit-8683585770050569841 with arguments [--stacktrace, spotlessApply] Output: > Task :spotlessInternalRegisterDependencies > Task :spotlessMybiome Biome stderr ouptut for file '/tmp/junit-8683585770050569841/biome_test.js' format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Format with errors is disabled. > Task :spotlessMybiomeApply > Task :spotlessApply BUILD SUCCESSFUL in 966ms 3 actionable tasks: 3 executed
Raw output
org.gradle.testkit.runner.UnexpectedBuildSuccess: Unexpected build execution success in /tmp/junit-8683585770050569841 with arguments [--stacktrace, spotlessApply]

Output:
> Task :spotlessInternalRegisterDependencies

> Task :spotlessMybiome
Biome stderr ouptut for file '/tmp/junit-8683585770050569841/biome_test.js'
format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Format with errors is disabled.

> Task :spotlessMybiomeApply
> Task :spotlessApply

BUILD SUCCESSFUL in 966ms
3 actionable tasks: 3 executed

	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.lambda$buildAndFail$3(DefaultGradleRunner.java:283)
	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.run(DefaultGradleRunner.java:367)
	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.buildAndFail(DefaultGradleRunner.java:281)
	at app//com.diffplug.gradle.spotless.BiomeIntegrationTest.failureWhenNotParseable(BiomeIntegrationTest.java:390)
	at java.base@22.0.2/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base@22.0.2/java.util.ArrayList.forEach(ArrayList.java:1597)
	at java.base@22.0.2/java.util.ArrayList.forEach(ArrayList.java:1597)

Check failure on line 390 in plugin-gradle/src/test/java/com/diffplug/gradle/spotless/BiomeIntegrationTest.java

GitHub Actions / JUnit gradle 21 ubuntu-latest

BiomeIntegrationTest.failureWhenNotParseable()

org.gradle.testkit.runner.UnexpectedBuildSuccess: Unexpected build execution success in /tmp/junit-12782196125808239091 with arguments [--stacktrace, spotlessApply] Output: > Task :spotlessInternalRegisterDependencies > Task :spotlessMybiome Biome stderr ouptut for file '/tmp/junit-12782196125808239091/biome_test.js' format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Format with errors is disabled. > Task :spotlessMybiomeApply > Task :spotlessApply BUILD SUCCESSFUL in 461ms 3 actionable tasks: 3 executed
Raw output
org.gradle.testkit.runner.UnexpectedBuildSuccess: Unexpected build execution success in /tmp/junit-12782196125808239091 with arguments [--stacktrace, spotlessApply]

Output:
> Task :spotlessInternalRegisterDependencies

> Task :spotlessMybiome
Biome stderr ouptut for file '/tmp/junit-12782196125808239091/biome_test.js'
format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Format with errors is disabled.

> Task :spotlessMybiomeApply
> Task :spotlessApply

BUILD SUCCESSFUL in 461ms
3 actionable tasks: 3 executed

	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.lambda$buildAndFail$3(DefaultGradleRunner.java:283)
	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.run(DefaultGradleRunner.java:367)
	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.buildAndFail(DefaultGradleRunner.java:281)
	at app//com.diffplug.gradle.spotless.BiomeIntegrationTest.failureWhenNotParseable(BiomeIntegrationTest.java:390)
	at java.base@21.0.4/java.lang.reflect.Method.invoke(Method.java:580)
	at java.base@21.0.4/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base@21.0.4/java.util.ArrayList.forEach(ArrayList.java:1596)

Check failure on line 390 in plugin-gradle/src/test/java/com/diffplug/gradle/spotless/BiomeIntegrationTest.java

GitHub Actions / JUnit gradle 11 ubuntu-latest

BiomeIntegrationTest.failureWhenNotParseable()

org.gradle.testkit.runner.UnexpectedBuildSuccess: Unexpected build execution success in /tmp/junit-12327465920563580056 with arguments [--stacktrace, spotlessApply] Output: > Task :spotlessInternalRegisterDependencies > Task :spotlessMybiome Biome stderr ouptut for file '/tmp/junit-12327465920563580056/biome_test.js' format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Format with errors is disabled. > Task :spotlessMybiomeApply > Task :spotlessApply BUILD SUCCESSFUL in 523ms 3 actionable tasks: 3 executed
Raw output
org.gradle.testkit.runner.UnexpectedBuildSuccess: Unexpected build execution success in /tmp/junit-12327465920563580056 with arguments [--stacktrace, spotlessApply]

Output:
> Task :spotlessInternalRegisterDependencies

> Task :spotlessMybiome
Biome stderr ouptut for file '/tmp/junit-12327465920563580056/biome_test.js'
format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Format with errors is disabled.

> Task :spotlessMybiomeApply
> Task :spotlessApply

BUILD SUCCESSFUL in 523ms
3 actionable tasks: 3 executed

	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.lambda$buildAndFail$3(DefaultGradleRunner.java:283)
	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.run(DefaultGradleRunner.java:367)
	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.buildAndFail(DefaultGradleRunner.java:281)
	at app//com.diffplug.gradle.spotless.BiomeIntegrationTest.failureWhenNotParseable(BiomeIntegrationTest.java:390)
	at java.base@11.0.24/java.lang.reflect.Method.invoke(Method.java:566)
	at java.base@11.0.24/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base@11.0.24/java.util.ArrayList.forEach(ArrayList.java:1541)

Check failure on line 390 in plugin-gradle/src/test/java/com/diffplug/gradle/spotless/BiomeIntegrationTest.java

GitHub Actions / JUnit gradle 17 ubuntu-latest

BiomeIntegrationTest.failureWhenNotParseable()

org.gradle.testkit.runner.UnexpectedBuildSuccess: Unexpected build execution success in /tmp/junit-17518879421862323847 with arguments [--stacktrace, spotlessApply] Output: > Task :spotlessInternalRegisterDependencies > Task :spotlessMybiome Biome stderr ouptut for file '/tmp/junit-17518879421862323847/biome_test.js' format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × Format with errors is disabled. > Task :spotlessMybiomeApply > Task :spotlessApply BUILD SUCCESSFUL in 464ms 3 actionable tasks: 3 executed
Raw output
org.gradle.testkit.runner.UnexpectedBuildSuccess: Unexpected build execution success in /tmp/junit-17518879421862323847 with arguments [--stacktrace, spotlessApply]

Output:
> Task :spotlessInternalRegisterDependencies

> Task :spotlessMybiome
Biome stderr ouptut for file '/tmp/junit-17518879421862323847/biome_test.js'
format ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  × Format with errors is disabled.

> Task :spotlessMybiomeApply
> Task :spotlessApply

BUILD SUCCESSFUL in 464ms
3 actionable tasks: 3 executed

	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.lambda$buildAndFail$3(DefaultGradleRunner.java:283)
	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.run(DefaultGradleRunner.java:367)
	at app//org.gradle.testkit.runner.internal.DefaultGradleRunner.buildAndFail(DefaultGradleRunner.java:281)
	at app//com.diffplug.gradle.spotless.BiomeIntegrationTest.failureWhenNotParseable(BiomeIntegrationTest.java:390)
	at java.base@17.0.12/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base@17.0.12/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base@17.0.12/java.util.ArrayList.forEach(ArrayList.java:1511)
assertThat(spotlessApply.getOutput()).contains("spotlessMybiome FAILED");
assertFile("biome_test.js").sameAsResource("biome/js/fileBefore.js");
assertThat(spotlessApply.getOutput()).contains("Format with errors is disabled.");
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.