Skip to content

Commit e7423ef

Browse files
committed
Add linting for server
1 parent 9bd6604 commit e7423ef

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

.github/workflows/ci-cd.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
pip install flake8
6464
flake8 . || exit 1
6565
working-directory: genai
66-
66+
6767
- name: Run Tests
6868
run: |
6969
pytest --maxfail=1 --disable-warnings -q
@@ -98,6 +98,10 @@ jobs:
9898
run: chmod +x gradlew
9999
working-directory: server
100100

101+
- name: Lint Java code
102+
run: ./gradlew check
103+
working-directory: server
104+
101105
- name: Build API Gateway microservice
102106
run: ./gradlew :api-gw:build
103107
working-directory: server

server/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ plugins {
33
id("io.spring.dependency-management") version "1.1.4" apply false
44
id("com.google.cloud.tools.jib") version "3.4.1" apply false
55
id("java")
6+
id("checkstyle")
67
}
78

89
subprojects {
910
apply(plugin = "java")
1011
apply(plugin = "org.springframework.boot")
1112
apply(plugin = "io.spring.dependency-management")
1213
apply(plugin = "com.google.cloud.tools.jib")
14+
apply(plugin = "checkstyle")
1315

1416
group = "com.continuousdisappointment"
1517
version = "0.0.1-SNAPSHOT"
@@ -22,6 +24,11 @@ subprojects {
2224
mavenCentral()
2325
}
2426

27+
checkstyle {
28+
toolVersion = "10.26.1"
29+
configFile = rootProject.file("config/checkstyle.xml")
30+
}
31+
2532
dependencies {
2633
implementation("org.springframework.boot:spring-boot-starter-web")
2734
implementation("org.springframework.boot:spring-boot-starter-actuator")

server/config/checkstyle.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
4+
"https://www.puppycrawl.com/dtds/configuration_1_3.dtd">
5+
<module name="com.puppycrawl.tools.checkstyle.Checker">
6+
<property name="charset" value="UTF-8"/>
7+
8+
<!-- Google's Checkstyle config as a base -->
9+
<module name="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck">
10+
<!-- You can configure header checks here -->
11+
</module>
12+
13+
<module name="com.puppycrawl.tools.checkstyle.TreeWalker">
14+
<module name="com.puppycrawl.tools.checkstyle.checks.imports.UnusedImportsCheck"/>
15+
<module name="com.puppycrawl.tools.checkstyle.checks.naming.ConstantNameCheck"/>
16+
</module>
17+
</module>

0 commit comments

Comments
 (0)