From 8b110c9971469d8d76a7d5a4f66694ee337d43e5 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Fri, 25 Nov 2022 17:32:59 +0100 Subject: [PATCH] Reinstate checkstyle for reference docs code snippets This commit also ensures that checks are performed before the application is rendered to get early feedback on errors. --- framework-docs/framework-docs.gradle | 6 ++---- .../hints/testing/SampleReflectionRuntimeHintsTests.java | 5 ++--- src/checkstyle/checkstyle-suppressions.xml | 3 +++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/framework-docs/framework-docs.gradle b/framework-docs/framework-docs.gradle index a9cd30f7c7..0f85f8228d 100644 --- a/framework-docs/framework-docs.gradle +++ b/framework-docs/framework-docs.gradle @@ -18,10 +18,6 @@ dependencies { implementation("org.assertj:assertj-core") } -checkstyle { - sourceSets = [] -} - jar { enabled = false } @@ -128,6 +124,8 @@ asciidoctor { } } +asciidoctor.mustRunAfter "check" + /** * Generate the Spring Framework Reference documentation from "src/docs/asciidoc" * in "build/docs/ref-docs/pdf". diff --git a/framework-docs/src/main/java/org/springframework/docs/core/aot/hints/testing/SampleReflectionRuntimeHintsTests.java b/framework-docs/src/main/java/org/springframework/docs/core/aot/hints/testing/SampleReflectionRuntimeHintsTests.java index dbbc43863f..5d666cc928 100644 --- a/framework-docs/src/main/java/org/springframework/docs/core/aot/hints/testing/SampleReflectionRuntimeHintsTests.java +++ b/framework-docs/src/main/java/org/springframework/docs/core/aot/hints/testing/SampleReflectionRuntimeHintsTests.java @@ -39,9 +39,8 @@ class SampleReflectionRuntimeHintsTests { void shouldRegisterReflectionHints() { RuntimeHints runtimeHints = new RuntimeHints(); // Call a RuntimeHintsRegistrar that contributes hints like: - runtimeHints.reflection().registerType(SpringVersion.class, typeHint -> { - typeHint.withMethod("getVersion", List.of(), ExecutableMode.INVOKE); - }); + runtimeHints.reflection().registerType(SpringVersion.class, typeHint -> + typeHint.withMethod("getVersion", List.of(), ExecutableMode.INVOKE)); // Invoke the relevant piece of code we want to test within a recording lambda RuntimeHintsInvocations invocations = RuntimeHintsRecorder.record(() -> { diff --git a/src/checkstyle/checkstyle-suppressions.xml b/src/checkstyle/checkstyle-suppressions.xml index b8e2a43db4..32019a4945 100644 --- a/src/checkstyle/checkstyle-suppressions.xml +++ b/src/checkstyle/checkstyle-suppressions.xml @@ -12,6 +12,9 @@ + + +