Add rule to prevent Spring conventions to be imported

See gh-871
This commit is contained in:
Stephane Nicoll 2019-03-17 11:22:36 +01:00
parent 738cf0f55b
commit 3818b5b05e
4 changed files with 40 additions and 1 deletions

View File

@ -9,6 +9,10 @@
<artifactId>initializr-generator-spring</artifactId>
<name>Spring Initializr :: Generator (Spring projects)</name>
<properties>
<main.basedir>${basedir}/..</main.basedir>
</properties>
<dependencies>
<dependency>
<groupId>io.spring.initializr</groupId>

View File

@ -193,8 +193,9 @@
<phase>validate</phase>
<configuration>
<skip>${disable.checks}</skip>
<configLocation>io/spring/javaformat/checkstyle/checkstyle.xml</configLocation>
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<propertyExpansion>main.basedir=${main.basedir}</propertyExpansion>
</configuration>
<goals>
<goal>check</goal>

View File

@ -0,0 +1,22 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<module name="com.puppycrawl.tools.checkstyle.Checker">
<module name="io.spring.javaformat.checkstyle.SpringChecks"/>
<module name="com.puppycrawl.tools.checkstyle.TreeWalker">
<module
name="com.puppycrawl.tools.checkstyle.checks.imports.ImportControlCheck">
<property name="file"
value="${main.basedir}/src/checkstyle/import-control.xml"/>
<property name="path" value="^.*[\\/]src[\\/]main[\\/].*$"/>
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineJavaCheck">
<property name="maximum" value="0"/>
<property name="format"
value="org\.mockito\.Mockito\.(when|doThrow|doAnswer)"/>
<property name="message"
value="Please use BDDMockito imports."/>
<property name="ignoreComments" value="true"/>
</module>
</module>
</module>

View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<!DOCTYPE import-control PUBLIC "-//Puppy Crawl//DTD Import Control 1.1//EN"
"http://www.puppycrawl.com/dtds/import_control_1_1.dtd">
<import-control pkg="io.spring.initializr">
<allow pkg=".*" regex="true"/>
<subpackage name="web">
<disallow pkg="io.spring.initializr.generator.spring"/>
</subpackage>
<subpackage name="actuate">
<disallow pkg="io.spring.initializr.generator.spring"/>
</subpackage>
</import-control>