Skip to content

Commit

Permalink
Add checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
obabec committed Feb 28, 2024
1 parent 37e2c1d commit fb935dd
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
100 changes: 100 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<?xml version="1.0"?>
<!--
~ Copyright Skodjob Authors.
~
~ Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

<module name="Checker">

<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="FileTabCharacter"/>

<module name="LineLength">
<property name="max" value="120"/>
</module>

<module name="Header">
<property name="header"
value="/*\n * Copyright Skodjob authors.\n * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).\n */"/>
<property name="fileExtensions" value="java"/>
</module>

<module name="TreeWalker">
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="MissingJavadocMethodCheck">
<property name="scope" value="public"/>
<property name="allowMissingPropertyJavadoc" value="true"/>
<property name="severity" value="warning" />
</module>
<module name="JavadocType">
<property name="scope" value="public"/>
<property name="severity" value="warning" />
</module>
<module name="JavadocStyle">
<property name="scope" value="public"/>
<property name="checkFirstSentence" value="false"/>
<property name="severity" value="warning" />
</module>

<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/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 http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport">
<property name="severity" value="warning" />
</module>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>

<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->

<module name="ParameterNumber"/>

<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifier.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>

<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="LeftCurly">
<property name="option" value="eol"/>
</module>
<module name="NeedBraces">
<property name="allowSingleLineStatement" value="true"/>
</module>
<module name="RightCurly"/>

<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="MissingSwitchDefault"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>

<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>

</module>
</module>
19 changes: 19 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
<maven.javadoc.version>3.4.1</maven.javadoc.version>
<maven.assembly.version>3.4.2</maven.assembly.version>
<maven.plugin.plugin.version>3.9.0</maven.plugin.plugin.version>
<checkstyle.config.location>checkstyle.xml</checkstyle.config.location>
<junit.jupiter.version>5.10.2</junit.jupiter.version>
</properties>

Expand Down Expand Up @@ -250,6 +251,24 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven.checkstyle.version}</version>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
Expand Down

0 comments on commit fb935dd

Please sign in to comment.