You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project follows HMCTS engineering standards for formatting, style, static analysis, and code coverage.
6
+
The following tools are configured and integrated with Gradle:
7
+
8
+
- Checkstyle – HMCTS Java code conventions
9
+
10
+
- SpotBugs – static analysis for potential defects
11
+
12
+
- JaCoCo – code coverage reporting
13
+
14
+
- EditorConfig – consistent whitespace and formatting rules
15
+
16
+
17
+
----------
18
+
19
+
## Checkstyle (HMCTS rules)
20
+
21
+
Checkstyle uses the HMCTS `checkstyle.xml`, enforcing naming, formatting, Javadoc, and structural rules.
22
+
23
+
### Run Checkstyle
24
+
25
+
`./gradlew checkstyleMain
26
+
./gradlew checkstyleTest`
27
+
28
+
### Run all Checkstyle tasks
29
+
30
+
`./gradlew checkstyle`
31
+
32
+
### Checkstyle reports
33
+
34
+
Reports are generated at:
35
+
36
+
`build/reports/checkstyle/`
37
+
38
+
----------
39
+
40
+
## SpotBugs (static analysis)
41
+
42
+
SpotBugs analyses compiled bytecode and flags potential null pointer issues, performance problems, and common Java defects.
43
+
44
+
### List SpotBugs tasks
45
+
46
+
`./gradlew tasks --all | grep spotbugs`
47
+
48
+
### Run SpotBugs on main code
49
+
50
+
`./gradlew spotbugsMain`
51
+
52
+
### Run SpotBugs on test code
53
+
54
+
`./gradlew spotbugsTest`
55
+
56
+
### Run all SpotBugs tasks
57
+
58
+
`./gradlew spotbugs`
59
+
60
+
### SpotBugs reports
61
+
62
+
`build/reports/spotbugs/`
63
+
64
+
----------
65
+
66
+
## JaCoCo (test coverage)
67
+
68
+
JaCoCo generates unit test and integration test coverage reports in XML and HTML.
69
+
70
+
### Run tests and generate JaCoCo reports
71
+
72
+
`./gradlew test jacocoTestReport`
73
+
74
+
### Coverage report location
75
+
76
+
`build/reports/jacoco/test/jacocoTestReport.html`
77
+
78
+
----------
79
+
80
+
## EditorConfig (formatting and whitespace)
81
+
82
+
The project uses HMCTS `.editorconfig` rules, enforcing:
83
+
84
+
- 2-space indentation for most files
85
+
86
+
- 4-space indentation for `.java` files
87
+
88
+
-`LF` line endings
89
+
90
+
- UTF-8 charset
91
+
92
+
- No trailing whitespace
93
+
94
+
- A newline at the end of every file
95
+
96
+
97
+
Most IDEs (including IntelliJ) apply these rules automatically.
98
+
99
+
----------
100
+
101
+
## Running all verification tasks
102
+
103
+
To verify everything before committing:
104
+
105
+
`./gradlew clean build`
106
+
107
+
This runs:
108
+
109
+
- Checkstyle
110
+
111
+
- SpotBugs
112
+
113
+
- Tests
114
+
115
+
- JaCoCo
116
+
117
+
- Compilation
118
+
119
+
- Packaging
120
+
121
+
----------
122
+
3
123
### Gradle Daemon: Stop the Daemon and Force a Clean Run
4
124
5
-
**Step 1: Forcefully stop all running Gradle daemons.**
125
+
**Step 1: Forcefully stop all running Gradle daemons.**
6
126
Forcefully stop all running Gradle daemons.
7
127
This command tells Gradle to find any background processes it has running and terminate them.
8
128
```Bash
@@ -12,5 +132,58 @@ This command tells Gradle to find any background processes it has running and te
12
132
**Step 2: Run a clean build.**
13
133
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.
0 commit comments