-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Project: Add Checkstyle for code style enforcement
- Loading branch information
1 parent
9bb1a23
commit b271e18
Showing
3 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Checkstyle | ||
|
||
on: [ pull_request ] | ||
|
||
jobs: | ||
checkstyle: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'adopt' | ||
- name: Run Checkstyle | ||
run: ./gradlew checkstyleMain checkstyleTest | ||
- name: Upload Checkstyle results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: checkstyle-results | ||
path: build/reports/checkstyle/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?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="charset" value="UTF-8"/> | ||
<property name="severity" value="warning"/> | ||
<property name="fileExtensions" value="java, properties, xml"/> | ||
|
||
<!-- Checks for whitespace --> | ||
<module name="FileTabCharacter"> | ||
<property name="eachLine" value="true"/> | ||
</module> | ||
|
||
<module name="TreeWalker"> | ||
<!-- Checks for Naming Conventions --> | ||
<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 --> | ||
<module name="AvoidStarImport"/> | ||
<module name="IllegalImport"/> | ||
<module name="RedundantImport"/> | ||
<module name="UnusedImports"/> | ||
|
||
<!-- Checks for Size Violations --> | ||
<module name="MethodLength"/> | ||
<module name="ParameterNumber"/> | ||
|
||
<!-- Checks for whitespace --> | ||
<module name="EmptyForIteratorPad"/> | ||
<module name="GenericWhitespace"/> | ||
<module name="MethodParamPad"/> | ||
<module name="NoWhitespaceAfter"/> | ||
<module name="NoWhitespaceBefore"/> | ||
<module name="OperatorWrap"/> | ||
<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="AvoidNestedBlocks"/> | ||
<module name="EmptyBlock"/> | ||
<module name="LeftCurly"/> | ||
<module name="NeedBraces"/> | ||
<module name="RightCurly"/> | ||
|
||
<!-- Checks for common coding problems --> | ||
<module name="EmptyStatement"/> | ||
<module name="EqualsHashCode"/> | ||
<module name="IllegalInstantiation"/> | ||
<module name="InnerAssignment"/> | ||
<module name="MagicNumber"/> | ||
<module name="MissingSwitchDefault"/> | ||
<module name="MultipleVariableDeclarations"/> | ||
<module name="SimplifyBooleanExpression"/> | ||
<module name="SimplifyBooleanReturn"/> | ||
|
||
<!-- Checks for class design --> | ||
<module name="DesignForExtension"/> | ||
<module name="FinalClass"/> | ||
<module name="HideUtilityClassConstructor"/> | ||
<module name="InterfaceIsType"/> | ||
<module name="VisibilityModifier"/> | ||
|
||
<!-- Miscellaneous other checks --> | ||
<module name="ArrayTypeStyle"/> | ||
<module name="FinalParameters"/> | ||
<module name="TodoComment"/> | ||
<module name="UpperEll"/> | ||
</module> | ||
</module> |