Skip to content

Commit

Permalink
checkstyle for Identity-API
Browse files Browse the repository at this point in the history
  • Loading branch information
harshsennnn committed Jan 15, 2025
1 parent 1c05cc0 commit 35a358f
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 1 deletion.
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'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ nbdist/
mvnw
mvnw.cmd
.mvn
command_output.log

# Properties
src/main/environment/1097_local.properties
Expand Down
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>
29 changes: 28 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,34 @@
</webResources>
</configuration>
</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

0 comments on commit 35a358f

Please sign in to comment.