Skip to content

Commit 80d8a5c

Browse files
committed
Add nohttp checkstyle rule
Closes gh-16682
1 parent 72268a2 commit 80d8a5c

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

spring-boot-parent/pom.xml

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
<url>https://www.spring.io</url>
1818
</organization>
1919
<properties>
20-
<main.basedir>..</main.basedir>
20+
<main.basedir>${basedir}/..</main.basedir>
2121
<disable.checks>false</disable.checks>
2222
<java.version>1.6</java.version>
2323
<aether.version>1.0.2.v20150114</aether.version>
2424
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2525
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2626
<maven.version>3.1.1</maven.version>
2727
<spring-javaformat.version>0.0.9</spring-javaformat.version>
28+
<nohttp-checkstyle.version>0.0.1.RELEASE</nohttp-checkstyle.version>
2829
</properties>
2930
<scm>
3031
<url>https://github.com/spring-projects/spring-boot</url>
@@ -318,6 +319,11 @@
318319
<artifactId>spring-javaformat-checkstyle</artifactId>
319320
<version>${spring-javaformat.version}</version>
320321
</dependency>
322+
<dependency>
323+
<groupId>io.spring.nohttp</groupId>
324+
<artifactId>nohttp-checkstyle</artifactId>
325+
<version>${nohttp-checkstyle.version}</version>
326+
</dependency>
321327
</dependencies>
322328
</plugin>
323329
<plugin>
@@ -533,6 +539,8 @@
533539
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
534540
<suppressionsLocation>src/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
535541
<includeTestSourceDirectory>true</includeTestSourceDirectory>
542+
<propertyExpansion>main.basedir=${main.basedir}</propertyExpansion>
543+
<resourceIncludes>**\/*.*</resourceIncludes>
536544
</configuration>
537545
<goals>
538546
<goal>check</goal>

spring-boot-parent/src/checkstyle/checkstyle-suppressions.xml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE suppressions PUBLIC
3-
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
4-
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
3+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
4+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
55
<suppressions>
6+
<suppress files="[\\/]target[\\/]" checks=".*" />
7+
<suppress files=".+\.[jar|git|ico|p12]" checks=".*" />
68
<suppress files="SpringApplicationTests\.java" checks="FinalClass" />
79
<suppress files=".+Configuration\.java" checks="HideUtilityClassConstructor" />
810
<suppress files=".+Application\.java" checks="HideUtilityClassConstructor" />

spring-boot-parent/src/checkstyle/checkstyle.xml

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?xml version="1.0"?>
22
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "https://checkstyle.org/dtds/configuration_1_2.dtd">
33
<module name="com.puppycrawl.tools.checkstyle.Checker">
4+
<module name="io.spring.nohttp.checkstyle.check.NoHttpCheck">
5+
<property name="whitelistFileName" value="${main.basedir}/spring-boot-parent/src/checkstyle/nohttp-whitelist.txt"/>
6+
</module>
47
<module name="io.spring.javaformat.checkstyle.SpringChecks" />
58
<module name="com.puppycrawl.tools.checkstyle.TreeWalker">
69
<module name="com.puppycrawl.tools.checkstyle.checks.imports.IllegalImportCheck">
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
^http://livereload.com/protocols/official-7$

spring-boot-samples/pom.xml

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<main.basedir>${basedir}/..</main.basedir>
2121
<java.version>1.8</java.version>
2222
<spring-javaformat.version>0.0.9</spring-javaformat.version>
23+
<nohttp-checkstyle.version>0.0.1.RELEASE</nohttp-checkstyle.version>
2324
<disable.checks>false</disable.checks>
2425
</properties>
2526
<modules>
@@ -155,6 +156,11 @@
155156
<artifactId>spring-javaformat-checkstyle</artifactId>
156157
<version>${spring-javaformat.version}</version>
157158
</dependency>
159+
<dependency>
160+
<groupId>io.spring.nohttp</groupId>
161+
<artifactId>nohttp-checkstyle</artifactId>
162+
<version>${nohttp-checkstyle.version}</version>
163+
</dependency>
158164
</dependencies>
159165
<executions>
160166
<execution>
@@ -165,6 +171,8 @@
165171
<configLocation>../spring-boot-parent/src/checkstyle/checkstyle.xml</configLocation>
166172
<suppressionsLocation>../spring-boot-parent/src/checkstyle/checkstyle-suppressions.xml</suppressionsLocation>
167173
<includeTestSourceDirectory>true</includeTestSourceDirectory>
174+
<propertyExpansion>main.basedir=${main.basedir}</propertyExpansion>
175+
<resourceIncludes>**\/*.*</resourceIncludes>
168176
</configuration>
169177
<goals>
170178
<goal>check</goal>

0 commit comments

Comments
 (0)