Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/checkstyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Call Checkstyle

on:
pull_request:
branches: ["master", "develop"]
paths:
- '**/*.java'

jobs:
style-check:
uses: PSMRI/.github/.github/workflows/checkstyle.yml@main
with:
java-version: '17'
65 changes: 65 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?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="severity" value="error" />
<property name="fileExtensions" value="java" />

<!-- Checks for Size Violations -->
<module name="FileLength">
<property name="max" value="500" />
</module>
<module name="LineLength">
<property name="max" value="120" />
</module>

<module name="TreeWalker">
<!-- Checks for Naming Conventions -->
<module name="MethodName" />
<module name="PackageName" />
<module name="TypeName" />
<module name="ParameterName" />
<module name="LocalVariableName" />
<module name="MemberName" />

<!-- Checks for imports -->
<module name="AvoidStarImport" />
<module name="IllegalImport" />
<module name="RedundantImport" />
<module name="UnusedImports" />

<!-- Checks for Size Violations -->
<module name="MethodLength">
<property name="max" value="50" />
</module>

<!-- Checks for whitespace -->
<module name="EmptyLineSeparator" />
<module name="GenericWhitespace" />
<module name="MethodParamPad" />
<module name="NoWhitespaceAfter" />
<module name="NoWhitespaceBefore" />
<module name="ParenPad" />
<module name="TypecastParenPad" />
<module name="WhitespaceAfter" />
<module name="WhitespaceAround" />

<!-- Modifier Checks -->
<module name="ModifierOrder" />
<module name="RedundantModifier" />

<!-- Checks for blocks -->
<module name="EmptyBlock" />
<module name="LeftCurly" />
<module name="RightCurly" />
<module name="NeedBraces" />

<!-- Checks for common coding problems -->
<module name="EmptyStatement" />
<module name="EqualsHashCode" />
<module name="IllegalInstantiation" />
<module name="MissingSwitchDefault" />
<module name="SimplifyBooleanExpression" />
<module name="SimplifyBooleanReturn" />
</module>
</module>
28 changes: 28 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,34 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.3.1</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.12.7</version>
</dependency>
</dependencies>
<configuration>
<configLocation>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>
</build>
<reporting>
Expand Down