Skip to content

Commit

Permalink
Project: Update Checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedMohamedAbdelaty committed Oct 30, 2024
1 parent b271e18 commit c2efea5
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 88 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/checkstyle.yml

This file was deleted.

76 changes: 38 additions & 38 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Java CI with Gradle

on: [push, pull_request]
on: [ push, pull_request ]

permissions:
contents: read
Expand All @@ -10,40 +10,40 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build -x test

- name: Run tests
run: ./gradlew test

- name: Publish Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: |
build/reports/tests/test/
build/test-results/test/
- name: Update status check
if: success()
run: echo "Tests passed" > status.txt || echo "Tests failed" > status.txt

- name: Upload status check
uses: actions/upload-artifact@v4
with:
name: status-check
path: status.txt
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run Checkstyle
run: ./gradlew checkstyleMain checkstyleTest

- name: Build with Gradle
run: ./gradlew build -x test

- name: Run tests
run: ./gradlew test

- name: Publish Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: |
build/reports/tests/test/
build/test-results/test/
- name: Publish Checkstyle Results
uses: actions/upload-artifact@v4
if: always()
with:
name: checkstyle-results
path: build/reports/checkstyle/
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
checkstyle {
toolVersion = "10.8.0"
configFile = file("config/checkstyle/checkstyle.xml")
maxWarnings = 0
maxWarnings = 30
}

tasks.withType(Checkstyle).configureEach {
Expand Down
33 changes: 5 additions & 28 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@

<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"/>
<module name="MethodName"/>
<module name="ConstantName"/>

<!-- Checks for imports -->
<module name="AvoidStarImport"/>
Expand All @@ -32,27 +27,24 @@
<module name="UnusedImports"/>

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

<!-- 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"/>
Expand All @@ -61,25 +53,10 @@
<!-- 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>

0 comments on commit c2efea5

Please sign in to comment.