Skip to content

Commit 268e3fe

Browse files
edyda99sbrannen
authored andcommitted
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
1 parent 9b50c0d commit 268e3fe

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/checkstyle/checkstyle-suppressions.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,13 @@
130130
<suppress files="sockjs[\\/]transport[\\/]TransportType" checks="JavadocVariable"/>
131131
<suppress files="src[\\/]test[\\/]java[\\/]org[\\/]springframework[\\/]web[\\/]reactive[\\/]protobuf[\\/].*" checks=".*"/>
132132

133+
<!-- Suppress JavadocPackage checks on packages outside of src/main-->
134+
<!-- And outside 'framework-docs' module-->
135+
<!-- And outside 'spring-core/src/main/java/org/springframework/asm' package-->
136+
<!-- And outside 'spring-core/src/main/java/org/springframework/cglib' package-->
137+
<!-- And outside 'spring-core/src/main/java/org/springframework/objenesis' package-->
138+
<!-- And outside 'spring-core/src/main/java/org/springframework/javapoet' package-->
139+
<!-- And outside 'spring-core/src/main/java/org/springframework/lang' package-->
140+
<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.*)"/>
141+
133142
</suppressions>

src/checkstyle/checkstyle.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,9 @@
240240
<module name="io.spring.javaformat.checkstyle.check.SpringJavadocCheck"/>
241241
<module name="io.spring.javaformat.checkstyle.check.SpringJUnit5Check"/>
242242
</module>
243+
244+
<!--package-info checker -->
245+
<module name="JavadocPackage">
246+
<property name="severity" value="warning"/>
247+
</module>
243248
</module>

0 commit comments

Comments
 (0)