This project follows HMCTS engineering standards for formatting, style, static analysis, and code coverage. The following tools are configured and integrated with Gradle:
-
Checkstyle – HMCTS Java code conventions
-
SpotBugs – static analysis for potential defects
-
JaCoCo – code coverage reporting
-
EditorConfig – consistent whitespace and formatting rules
Checkstyle uses the HMCTS checkstyle.xml, enforcing naming, formatting, Javadoc, and structural rules.
./gradlew checkstyleMain
or
./gradlew checkstyleTest
./gradlew checkstyle
Reports are generated at:
build/reports/checkstyle/
SpotBugs analyses compiled bytecode and flags potential null pointer issues, performance problems, and common Java defects.
./gradlew tasks --all | grep spotbugs
./gradlew spotbugsMain
./gradlew spotbugsTest
./gradlew spotbugs
build/reports/spotbugs/
JaCoCo generates unit test and integration test coverage reports in XML and HTML.
./gradlew test jacocoTestReport
build/reports/jacoco/test/html/index.html
The project uses HMCTS .editorconfig rules, enforcing:
-
2-space indentation for most files
-
4-space indentation for
.javafiles -
LFline endings -
UTF-8 charset
-
No trailing whitespace
-
A newline at the end of every file
Most IDEs (including IntelliJ) apply these rules automatically.
To verify everything before committing:
./gradlew clean build
This runs:
-
Checkstyle
-
SpotBugs
-
Tests
-
JaCoCo
-
Compilation
-
Packaging
Step 1: Forcefully stop all running Gradle daemons. This command tells Gradle to find any background processes it has running and terminate them.
./gradlew --stopStep 2: Run a clean build. The clean task deletes the entire build directory. This removes any old, compiled artifacts and cached results, ensuring nothing stale is left over. We will combine it with the checkstyleMain task.
./gradlew clean [checkstyleMain]-
Install the Checkstyle-IDEA plugin
-
Open IntelliJ settings:
Settings → Tools → Checkstyle -
Add the configuration file:
config/checkstyle/checkstyle.xml -
Set it as the default configuration
-
(Optional) Enable “Scan before check-in”
Verify the following setting is enabled:
Settings → Editor → Code Style → Enable EditorConfig support
Use IntelliJ’s reformat command:
Windows/Linux: Ctrl + Alt + L macOS: Cmd + Option + L
This project aligns with HMCTS engineering standards:
-
HMCTS Checkstyle enforcement
-
SpotBugs static analysis
-
JaCoCo coverage reports
-
HMCTS EditorConfig formatting
-
Spotless removed (not used by HMCTS)