Browse Source

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.
pull/29590/head
Brian Clozel 2 years ago
parent
commit
8b110c9971
  1. 6
      framework-docs/framework-docs.gradle
  2. 5
      framework-docs/src/main/java/org/springframework/docs/core/aot/hints/testing/SampleReflectionRuntimeHintsTests.java
  3. 3
      src/checkstyle/checkstyle-suppressions.xml

6
framework-docs/framework-docs.gradle

@ -18,10 +18,6 @@ dependencies { @@ -18,10 +18,6 @@ dependencies {
implementation("org.assertj:assertj-core")
}
checkstyle {
sourceSets = []
}
jar {
enabled = false
}
@ -128,6 +124,8 @@ asciidoctor { @@ -128,6 +124,8 @@ asciidoctor {
}
}
asciidoctor.mustRunAfter "check"
/**
* Generate the Spring Framework Reference documentation from "src/docs/asciidoc"
* in "build/docs/ref-docs/pdf".

5
framework-docs/src/main/java/org/springframework/docs/core/aot/hints/testing/SampleReflectionRuntimeHintsTests.java

@ -39,9 +39,8 @@ class SampleReflectionRuntimeHintsTests { @@ -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(() -> {

3
src/checkstyle/checkstyle-suppressions.xml

@ -12,6 +12,9 @@ @@ -12,6 +12,9 @@
<!-- JMH benchmarks -->
<suppress files="[\\/]src[\\/]jmh[\\/]java[\\/]org[\\/]springframework[\\/]" checks="JavadocVariable|JavadocStyle|InnerTypeLast"/>
<!-- Framework docs -->
<suppress files="org[\\/]springframework[\\/]docs[\\/].+" checks="IllegalImport" id="bannedJUnitJupiterImports" />
<!-- spring-aop -->
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]org[\\/]aopalliance[\\/]" checks="IllegalImport" id="bannedImports" message="javax"/>

Loading…
Cancel
Save