diff --git a/build.gradle b/build.gradle index 24111873..fc268de2 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' version '3.3.1' id 'io.spring.dependency-management' version '1.1.5' + id 'checkstyle' } group = 'taco' @@ -38,6 +39,16 @@ dependencies { testRuntimeOnly 'org.junit.platform:junit-platform-launcher' } -tasks.named('test') { +checkstyle { + maxWarnings = 0 + toolVersion = '9.3' + configFile = file("${rootDir}/tool/naver-checkstyle-rules.xml") + configProperties = ["suppressionFile": "${rootDir}/tool/naver-checkstyle-suppressions.xml"] + +} + +test { useJUnitPlatform() + dependsOn 'checkstyleMain' + dependsOn 'checkstyleTest' } diff --git a/src/main/java/taco/klkl/global/config/swagger/SwaggerConfig.java b/src/main/java/taco/klkl/global/config/swagger/SwaggerConfig.java index 4674ef3c..c709d9d6 100644 --- a/src/main/java/taco/klkl/global/config/swagger/SwaggerConfig.java +++ b/src/main/java/taco/klkl/global/config/swagger/SwaggerConfig.java @@ -16,7 +16,7 @@ @Configuration public class SwaggerConfig { @Bean - public GroupedOpenApi KlklOpenApi() { + public GroupedOpenApi klklOpenApi() { // "/v1/**" 경로에 매칭되는 API를 그룹화하여 문서화한다. String[] paths = {"/v1/**"}; @@ -25,4 +25,4 @@ public GroupedOpenApi KlklOpenApi() { .pathsToMatch(paths) // 그룹에 속하는 경로 패턴을 지정한다. .build(); } -} \ No newline at end of file +} diff --git a/src/main/java/taco/klkl/global/error/ErrorResponse.java b/src/main/java/taco/klkl/global/error/ErrorResponse.java index 291e0b20..99114812 100644 --- a/src/main/java/taco/klkl/global/error/ErrorResponse.java +++ b/src/main/java/taco/klkl/global/error/ErrorResponse.java @@ -4,4 +4,4 @@ public record ErrorResponse(String code, String message) { public static ErrorResponse of(String code, String message) { return new ErrorResponse(code, message); } -} \ No newline at end of file +} diff --git a/src/main/java/taco/klkl/global/error/exception/CustomException.java b/src/main/java/taco/klkl/global/error/exception/CustomException.java index 05b74ca7..e0905659 100644 --- a/src/main/java/taco/klkl/global/error/exception/CustomException.java +++ b/src/main/java/taco/klkl/global/error/exception/CustomException.java @@ -10,4 +10,4 @@ public CustomException(ErrorCode errorCode) { super(errorCode.getMessage()); this.errorCode = errorCode; } -} \ No newline at end of file +} diff --git a/src/main/java/taco/klkl/global/response/GlobalResponseAdvice.java b/src/main/java/taco/klkl/global/response/GlobalResponseAdvice.java index e55ec6d0..546296a6 100644 --- a/src/main/java/taco/klkl/global/response/GlobalResponseAdvice.java +++ b/src/main/java/taco/klkl/global/response/GlobalResponseAdvice.java @@ -44,4 +44,4 @@ public Object beforeBodyWrite( } return body; } -} \ No newline at end of file +} diff --git a/src/test/java/taco/klkl/global/error/GlobalExceptionHandlerTest.java b/src/test/java/taco/klkl/global/error/GlobalExceptionHandlerTest.java index 71ef8249..de88c144 100644 --- a/src/test/java/taco/klkl/global/error/GlobalExceptionHandlerTest.java +++ b/src/test/java/taco/klkl/global/error/GlobalExceptionHandlerTest.java @@ -76,7 +76,7 @@ void httpRequestMethodNotSupportedOccurred() { @Test @DisplayName("ExceptionInternal이 발생한 경우") - void ExceptionInternalOccurred() { + void exceptionInternalOccurred() { // given Exception exception = new RuntimeException("Test exception"); HttpHeaders headers = new HttpHeaders(); @@ -136,4 +136,4 @@ void handleException() { assertEquals("C012", errorResponse.code()); assertEquals("서버에 문제가 발생했습니다. 관리자에게 문의해주세요.", errorResponse.message()); } -} \ No newline at end of file +} diff --git a/src/test/java/taco/klkl/global/response/GlobalResponseAdviceTest.java b/src/test/java/taco/klkl/global/response/GlobalResponseAdviceTest.java index 90f368c4..2f733a63 100644 --- a/src/test/java/taco/klkl/global/response/GlobalResponseAdviceTest.java +++ b/src/test/java/taco/klkl/global/response/GlobalResponseAdviceTest.java @@ -102,4 +102,4 @@ void testBeforeBodyWrite_WithNullHttpStatus() { // Then assertEquals(body, result); } -} \ No newline at end of file +} diff --git a/tool/naver-checkstyle-rules.xml b/tool/naver-checkstyle-rules.xml new file mode 100644 index 00000000..0b410a21 --- /dev/null +++ b/tool/naver-checkstyle-rules.xml @@ -0,0 +1,439 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tool/naver-checkstyle-suppressions.xml b/tool/naver-checkstyle-suppressions.xml new file mode 100644 index 00000000..3f11e0cd --- /dev/null +++ b/tool/naver-checkstyle-suppressions.xml @@ -0,0 +1,7 @@ + + + + +