DATAGRAPH-1176 - Add checkstyle for enforcing headers.

# Conflicts:
#	pom.xml
This commit is contained in:
Michael Simons
2019-01-09 15:13:43 +01:00
parent 62d77d6d65
commit d2c8349498
4 changed files with 91 additions and 2 deletions

21
checkstyle/config.xml Normal file
View File

@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<property name="fileExtensions" value="java, properties, xml"/>
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>
<module name="RegexpHeader">
<property name="headerFile" value="${checkstyle.header.file}" />
<property name="fileExtensions" value="java" />
</module>
<module name="NewlineAtEndOfFile"/>
<module name="SuppressWarningsFilter" />
</module>

View File

@@ -0,0 +1,17 @@
^\Q/*\E$
^\Q * Copyright 2011-2019 the original author or authors.\E$
^\Q *\E$
^\Q * Licensed under the Apache License, Version 2.0 (the "License");\E$
^\Q * you may not use this file except in compliance with the License.\E$
^\Q * You may obtain a copy of the License at\E$
^\Q *\E$
^\Q * http://www.apache.org/licenses/LICENSE-2.0\E$
^\Q *\E$
^\Q * Unless required by applicable law or agreed to in writing, software\E$
^\Q * distributed under the License is distributed on an "AS IS" BASIS,\E$
^\Q * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\E$
^\Q * See the License for the specific language governing permissions and\E$
^\Q * limitations under the License.\E$
^\Q */\E$
^\Qpackage\E .+;$
^.*$

View File

@@ -0,0 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress checks="RegexpHeader" files="package-info\.java"/>
</suppressions>

48
pom.xml
View File

@@ -35,11 +35,14 @@
</modules>
<properties>
<project.type>multi</project.type>
<dist.id>spring-data-neo4j</dist.id>
<project.type>multi</project.type>
<checkstyle.version>8.16</checkstyle.version>
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
<neo4j.ogm.version>3.2.0-alpha01</neo4j.ogm.version>
<springdata.commons>2.2.0.BUILD-SNAPSHOT</springdata.commons>
<source.level>1.8</source.level>
</properties>
<developers>
@@ -206,4 +209,45 @@
</pluginRepository>
</pluginRepositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<configuration>
<configLocation>checkstyle/config.xml</configLocation>
<suppressionsLocation>checkstyle/suppressions.xml</suppressionsLocation>
<headerLocation>checkstyle/java-header.txt</headerLocation>
<encoding>${project.build.sourceEncoding}</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>