Skip to content

Commit 2deb078

Browse files
Flossyclaude
andcommitted
feat: update CONTRIBUTING.md and increase code coverage threshold
Implements issues #331 and #328 to improve code quality standards and testing requirements. Changes: 1. Updated CONTRIBUTING.md: - Added Spotless auto-formatting documentation - Updated code style to Google Java Style (2 spaces) - Enhanced Checkstyle section with key rules - Added automatic formatting commands - Clarified formatting vs validation tools - Updated examples to match Google Style 2. Increased JaCoCo Coverage Threshold (Issue #328): - Instruction coverage: 1% → 60% - Branch coverage: 1% → 60% - Line coverage: 1% → 60% - Missed class count: 100 → 10 Quality Improvements: - Enforces 60% minimum code coverage (industry standard) - Ensures new code includes adequate testing - Automatic formatting reduces code review friction - Clear contribution guidelines for new developers - Consistent code style across all modules Developer Workflow: ```bash # Before committing: mvn spotless:apply # Auto-format code mvn clean verify # Run all checks including coverage # Checks that run automatically: - Spotless format check - Checkstyle validation - JaCoCo coverage validation (60% minimum) - OWASP dependency scan ``` Breaking Change: Projects with less than 60% coverage will now fail the build. This is intentional to ensure quality standards. Teams should: 1. Add tests for existing uncovered code, or 2. Temporarily exclude legacy modules from coverage checks Coverage can be checked before commit: ```bash mvn clean test jacoco:report # View: target/site/jacoco/index.html ``` Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 83ab1a9 commit 2deb078

2 files changed

Lines changed: 68 additions & 14 deletions

File tree

CONTRIBUTING.md

Lines changed: 64 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -266,28 +266,47 @@ java -jar platform-launcher/target/platform-launcher-1.1.jar \
266266

267267
### Java Code Style
268268

269-
We follow standard Java conventions with some specific rules:
269+
We follow **Google Java Style** enforced by Spotless and Checkstyle:
270270

271271
#### 1. Formatting
272-
- **Indentation**: 4 spaces (no tabs)
272+
273+
Code is automatically formatted using Spotless with Google Java Format:
274+
275+
```bash
276+
# Auto-format all code before committing
277+
mvn spotless:apply
278+
279+
# Check formatting without changing files
280+
mvn spotless:check
281+
```
282+
283+
**Key Formatting Rules**:
284+
- **Indentation**: 2 spaces (not tabs) - enforced by Google Java Format
273285
- **Line length**: 120 characters max
274286
- **Braces**: K&R style (opening brace on same line)
275287

276288
```java
277-
// Good
289+
// Good (Google Java Style - 2 space indent)
290+
public void myMethod() {
291+
if (condition) {
292+
doSomething();
293+
}
294+
}
295+
296+
// Bad - wrong indentation
278297
public void myMethod() {
279298
if (condition) {
280299
doSomething();
281300
}
282301
}
283302

284-
// Bad
303+
// Bad - wrong brace style
285304
public void myMethod()
286305
{
287-
if (condition)
288-
{
289-
doSomething();
290-
}
306+
if (condition)
307+
{
308+
doSomething();
309+
}
291310
}
292311
```
293312

@@ -352,15 +371,50 @@ logger.info("Deploying application: {}", appId);
352371
System.out.println("Deploying application: " + appId);
353372
```
354373

355-
### Checkstyle
374+
### Automated Code Quality Tools
375+
376+
#### Spotless (Auto-Formatting)
377+
378+
Spotless automatically formats code to Google Java Style:
379+
380+
```bash
381+
# Format all code (run before committing)
382+
mvn spotless:apply
383+
384+
# Check if code is formatted correctly
385+
mvn spotless:check
386+
387+
# Runs automatically during verify phase
388+
mvn clean verify
389+
```
390+
391+
**What Spotless Does**:
392+
- Applies Google Java Format
393+
- Removes unused imports
394+
- Trims trailing whitespace
395+
- Ensures file ends with newline
396+
397+
#### Checkstyle (Style Validation)
356398

357399
All code must pass Checkstyle validation:
358400

359401
```bash
402+
# Check code style
360403
mvn checkstyle:check
404+
405+
# Runs automatically during validate phase
406+
mvn clean verify
361407
```
362408

363-
Configuration: `checkstyle.xml` (based on Google Java Style)
409+
**Configuration**: `checkstyle.xml` (based on Google Java Style with FlossWare conventions)
410+
411+
**Key Rules**:
412+
- No wildcard imports (`import java.util.*`)
413+
- Missing `@Override` annotations detected
414+
- Method length limit: 150 lines
415+
- Parameter count limit: 7
416+
- Nested block depth limits
417+
- Javadoc required for public APIs
364418

365419
Common violations to avoid:
366420
- Wildcard imports (`import java.util.*;`)

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,22 +355,22 @@
355355
<limit>
356356
<counter>INSTRUCTION</counter>
357357
<value>COVEREDRATIO</value>
358-
<minimum>0.01</minimum>
358+
<minimum>0.60</minimum>
359359
</limit>
360360
<limit>
361361
<counter>BRANCH</counter>
362362
<value>COVEREDRATIO</value>
363-
<minimum>0.01</minimum>
363+
<minimum>0.60</minimum>
364364
</limit>
365365
<limit>
366366
<counter>LINE</counter>
367367
<value>COVEREDRATIO</value>
368-
<minimum>0.01</minimum>
368+
<minimum>0.60</minimum>
369369
</limit>
370370
<limit>
371371
<counter>CLASS</counter>
372372
<value>MISSEDCOUNT</value>
373-
<maximum>100</maximum>
373+
<maximum>10</maximum>
374374
</limit>
375375
</limits>
376376
</rule>

0 commit comments

Comments
 (0)