Skip to content

Commit

Permalink
Checkstyle configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Oct 18, 2019
1 parent 4ba2946 commit fbe22f7
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 8 deletions.
56 changes: 48 additions & 8 deletions build-system/pom.xml
Expand Up @@ -94,6 +94,7 @@
<activation.version>1.2.0</activation.version>
<jetty.version>9.4.20.v20190813</jetty.version>
<maven.api.version>3.6.2</maven.api.version>
<checkstyle.version>3.1.0</checkstyle.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down Expand Up @@ -1568,10 +1569,6 @@
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<!--plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>2.4</version> <configuration> <configLocation>http:///svn/coding-rules/CheckStyle-rules.xml</configLocation>
<includeTestSourceDirectory>false</includeTestSourceDirectory> </configuration>
</plugin -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
Expand Down Expand Up @@ -1710,6 +1707,34 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.version}</version>
<dependencies>
<dependency>
<groupId>com.evolveum.midpoint</groupId>
<artifactId>build-tools</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<configuration>
<configLocation>midpoint-build/checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

<pluginManagement>
Expand Down Expand Up @@ -1842,10 +1867,25 @@
<onlyAnalyze>com.evolveum.midpoint.*</onlyAnalyze>
</configuration>
</plugin>
<!--plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId>
<version>2.4</version> <configuration> <configLocation>http://svn/coding-rules/CheckStyle-rules.xml</configLocation>
<includeTestSourceDirectory>false</includeTestSourceDirectory> </configuration>
</plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.version}</version>
<configuration>
<configLocation>midpoint-build/checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>

Expand Down
39 changes: 39 additions & 0 deletions build-tools/pom.xml
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2019 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<!-- NO PARENT - by purpose -->

<groupId>com.evolveum.midpoint</groupId>
<artifactId>build-tools</artifactId>
<version>4.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>midPoint build tools</name>

<repositories>
<repository>
<id>evolveum</id>
<name>Evolveum Public Releases</name>
<url>http://nexus.evolveum.com/nexus/content/groups/public</url>
</repository>
<repository>
<id>evolveum-snapshots</id>
<name>Evolveum Snapshots</name>
<url>http://nexus.evolveum.com/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>

<build>
</build>

</project>
86 changes: 86 additions & 0 deletions build-tools/src/main/resources/midpoint-build/checkstyle.xml
@@ -0,0 +1,86 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!-- Based on checkstyle/src/main/resources/sun_checks.xml -->
<module name="Checker">
<!--
<property name="basedir" value="${basedir}"/>
-->
<property name="severity" value="error"/>

<property name="fileExtensions" value="java, properties, xml"/>

<!-- Excludes all 'module-info.java' files -->
<!-- See https://checkstyle.org/config_filefilters.html -->
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>

<!-- Checks whether files end with a new line. -->
<!-- See https://checkstyle.org/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>

<!-- Checks that property files contain the same keys. -->
<!-- See https://checkstyle.org/config_misc.html#Translation -->
<module name="Translation"/>


<!-- Checks for whitespace -->
<!-- See https://checkstyle.org/config_whitespace.html -->
<module name="FileTabCharacter"/>


<module name="TreeWalker">

<!-- Checks for Naming Conventions. -->
<!-- See https://checkstyle.org/config_naming.html -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>

<!-- Checks for imports -->
<!-- See https://checkstyle.org/config_import.html -->
<module name="RedundantImport"/>
<!-- <module name="UnusedImports">
<property name="processJavadoc" value="false"/>
</module> -->

<!-- Modifier Checks -->
<!-- See https://checkstyle.org/config_modifiers.html -->
<module name="RedundantModifier"/>

<!-- Checks for blocks. You know, those {}'s -->
<!-- See https://checkstyle.org/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="NeedBraces"/>

<!-- Checks for common coding problems -->
<!-- See https://checkstyle.org/config_coding.html -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="MultipleVariableDeclarations"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Checks for class design -->
<!-- See https://checkstyle.org/config_design.html -->
<module name="DesignForExtension"/>
<module name="FinalClass"/>
<module name="InterfaceIsType"/>

<!-- Miscellaneous other checks. -->
<!-- See https://checkstyle.org/config_misc.html -->
<module name="ArrayTypeStyle"/>
<module name="UpperEll"/>

</module>

</module>
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -161,6 +161,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>build-tools</module>
<module>build-system</module>
<module>tools</module>
<module>infra</module>
Expand Down

0 comments on commit fbe22f7

Please sign in to comment.