Skip to content

Commit 6c01215

Browse files
committed
chore(sticker-award): Setup checkstyle linting
1 parent 10309e4 commit 6c01215

4 files changed

Lines changed: 515 additions & 1 deletion

File tree

sticker-award/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,69 @@ The API returns standard HTTP status codes and follows the RFC 7807 Problem Deta
6060
Full API documentation is available in OpenAPI format:
6161
- Synchronous API: [api.yaml](./docs/api.yaml)
6262
- Asynchronous API: [async_api.json](./docs/async_api.json)
63+
64+
## Building and Running
65+
66+
### Prerequisites
67+
- Java 21+
68+
- Maven 3.8+
69+
70+
### Development
71+
72+
Run in development mode:
73+
```bash
74+
./mvnw compile quarkus:dev
75+
```
76+
77+
### Testing
78+
79+
Run tests:
80+
```bash
81+
./mvnw test
82+
```
83+
84+
Run integration tests:
85+
```bash
86+
./mvnw verify
87+
```
88+
89+
## Code Quality
90+
91+
### Checkstyle
92+
93+
This project uses Checkstyle to enforce coding standards based on the Google Java Style Guide.
94+
95+
**Run Checkstyle validation:**
96+
```bash
97+
# Check code style (runs automatically during build)
98+
./mvnw validate
99+
100+
# Run only Checkstyle check
101+
./mvnw checkstyle:check
102+
103+
# Generate Checkstyle report (creates HTML report at target/reports/checkstyle.html)
104+
./mvnw checkstyle:checkstyle
105+
```
106+
107+
### Spotless (Code Formatting)
108+
109+
This project uses Spotless with Google Java Format to automatically fix code style issues.
110+
111+
**Format your code:**
112+
```bash
113+
# Check if code formatting is correct
114+
./mvnw spotless:check
115+
116+
# Automatically fix code formatting issues
117+
./mvnw spotless:apply
118+
119+
# Format and then validate with Checkstyle
120+
./mvnw spotless:apply validate
121+
```
122+
123+
**Checkstyle Configuration:**
124+
- Configuration file: `checkstyle.xml`
125+
- Suppressions file: `checkstyle-suppressions.xml`
126+
- Based on Google Java Style Guide (modified for 4-space indentation)
127+
- Enforces 4-space indentation, 100-character line limit
128+
- Checks import ordering, Javadoc completeness, and naming conventions
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0"?>
2+
3+
<!DOCTYPE suppressions PUBLIC
4+
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
5+
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
6+
7+
<!--
8+
Checkstyle suppressions file for Sticker Award application.
9+
10+
This file allows you to suppress specific Checkstyle violations for certain files or patterns.
11+
Use this sparingly and only when necessary.
12+
13+
Examples:
14+
- Generated code that you don't control
15+
- Third-party code
16+
- Specific patterns that are acceptable in your codebase
17+
-->
18+
19+
<suppressions>
20+
<!-- Suppress all checks for generated files -->
21+
<suppress files=".*[\\/]generated[\\/].*\.java" checks=".*"/>
22+
23+
<!-- Suppress line length checks for test files with long URLs or test data -->
24+
<suppress files=".*Test\.java" checks="LineLength" lines="1-999999"/>
25+
26+
<!-- Allow missing Javadoc for test methods -->
27+
<suppress files=".*Test\.java" checks="MissingJavadocMethod"/>
28+
<suppress files=".*Test\.java" checks="JavadocMethod"/>
29+
30+
<!-- Allow missing Javadoc for test classes -->
31+
<suppress files=".*Test\.java" checks="MissingJavadocType"/>
32+
33+
<!-- Suppress abbreviation checks for common patterns like DTO, API, etc. -->
34+
<suppress files=".*DTO\.java" checks="AbbreviationAsWordInName"/>
35+
<suppress files=".*API\.java" checks="AbbreviationAsWordInName"/>
36+
37+
<!-- Allow longer lines in configuration classes -->
38+
<suppress files=".*Config\.java" checks="LineLength"/>
39+
40+
<!-- Suppress checks for application main classes -->
41+
<suppress files=".*Application\.java" checks="HideUtilityClassConstructor"/>
42+
</suppressions>

0 commit comments

Comments
 (0)