Browse Source

Configure Checkstyle to require package-info.java files

This commit updates the project's checkstyle configuration to require
the existence of a package-info.java file for all packages within the
src/main directory while excluding the framework-docs module and
certain packages inside the spring-core module. A missing
package-info.java file will result in emitting a warning.

See gh-30069
pull/30107/head
Ed .d 2 years ago committed by Sam Brannen
parent
commit
268e3fec99
  1. 9
      src/checkstyle/checkstyle-suppressions.xml
  2. 5
      src/checkstyle/checkstyle.xml

9
src/checkstyle/checkstyle-suppressions.xml

@ -130,4 +130,13 @@ @@ -130,4 +130,13 @@
<suppress files="sockjs[\\/]transport[\\/]TransportType" checks="JavadocVariable"/>
<suppress files="src[\\/]test[\\/]java[\\/]org[\\/]springframework[\\/]web[\\/]reactive[\\/]protobuf[\\/].*" checks=".*"/>
<!-- Suppress JavadocPackage checks on packages outside of src/main-->
<!-- And outside 'framework-docs' module-->
<!-- And outside 'spring-core/src/main/java/org/springframework/asm' package-->
<!-- And outside 'spring-core/src/main/java/org/springframework/cglib' package-->
<!-- And outside 'spring-core/src/main/java/org/springframework/objenesis' package-->
<!-- And outside 'spring-core/src/main/java/org/springframework/javapoet' package-->
<!-- And outside 'spring-core/src/main/java/org/springframework/lang' package-->
<suppress checks="JavadocPackage" files="(^(?!.*src[\\/]main[\\/]).*)|(.*framework-docs.*)|(.*spring-core\/src\/main\/java\/org\/springframework\/asm.*)|(.*spring-core\/src\/main\/java\/org\/springframework\/cglib.*)|(.*spring-core\/src\/main\/java\/org\/springframework\/objenesis.*)|(.*spring-core\/src\/main\/java\/org\/springframework\/javapoet.*)|(.*spring-core\/src\/main\/java\/org\/springframework\/lang.*)"/>
</suppressions>

5
src/checkstyle/checkstyle.xml

@ -240,4 +240,9 @@ @@ -240,4 +240,9 @@
<module name="io.spring.javaformat.checkstyle.check.SpringJavadocCheck"/>
<module name="io.spring.javaformat.checkstyle.check.SpringJUnit5Check"/>
</module>
<!--package-info checker -->
<module name="JavadocPackage">
<property name="severity" value="warning"/>
</module>
</module>

Loading…
Cancel
Save