From c24223a1cc079bfd4221c22fe1ac96a390cb5ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 22:25:02 +0900 Subject: [PATCH 01/13] =?UTF-8?q?build:=20checkstyle=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/build.gradle b/build.gradle index c0521259..2bc37add 100644 --- a/build.gradle +++ b/build.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'org.springframework.boot' version '3.5.8' id 'io.spring.dependency-management' version '1.1.7' + id 'checkstyle' } group = 'gg.agit' @@ -64,3 +65,23 @@ clean { tasks.named('test') { useJUnitPlatform() } + +checkstyle { + toolVersion = '10.12.5' + configFile = file("${rootDir}/config/checkstyle/checkstyle.xml") + configProperties = ['suppressionFile': "${rootDir}/config/checkstyle/suppressions.xml"] + maxWarnings = 0 + ignoreFailures = false +} + +checkstyleMain { + source = 'src/main/java' +} + +checkstyleTest { + source = 'src/test/java' +} + +tasks.named('build') { + dependsOn 'checkstyleMain' +} From b7cd51bda00924bd03a0d855be620c9547026056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 22:25:49 +0900 Subject: [PATCH 02/13] =?UTF-8?q?feat:=20checkstyle=20xml=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/checkstyle/checkstyle.xml | 255 +++++++++++++++++++++++++++++ config/checkstyle/suppressions.xml | 21 +++ 2 files changed, 276 insertions(+) create mode 100644 config/checkstyle/checkstyle.xml create mode 100644 config/checkstyle/suppressions.xml diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000..38cfe5d9 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml new file mode 100644 index 00000000..3ea5a7d4 --- /dev/null +++ b/config/checkstyle/suppressions.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + From b2550ca22e5b70860ee4ee2b932b1b5428d5f05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 22:49:21 +0900 Subject: [PATCH 03/13] =?UTF-8?q?fix:=20checkstyle=20import=20=EC=88=9C?= =?UTF-8?q?=EC=84=9C=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/checkstyle/checkstyle.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 38cfe5d9..a74d2a12 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -100,13 +100,12 @@ - + - @@ -252,4 +251,4 @@ - \ No newline at end of file + From c57bd58821c5722296a10d18b6fcbe52c274fe75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 22:57:57 +0900 Subject: [PATCH 04/13] =?UTF-8?q?fix:=20checkstyle=20import=20=EC=88=9C?= =?UTF-8?q?=EC=84=9C=20=EC=84=A4=EC=A0=95=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/checkstyle/checkstyle.xml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index a74d2a12..d5f10d68 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -100,16 +100,6 @@ - - - - - - - - - From 8fbdcd5ca582771f55923e140b8d1c68592094fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 23:04:25 +0900 Subject: [PATCH 05/13] =?UTF-8?q?fix:=20checkstyle=20=EC=99=80=EC=9D=BC?= =?UTF-8?q?=EB=93=9C=20=EC=B9=B4=EB=93=9C=20=EC=84=A4=EC=A0=95=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/checkstyle/checkstyle.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index d5f10d68..761df743 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -91,7 +91,7 @@ - + From c508269319a5e6a0691fa3935153daa0e5722c4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 23:08:57 +0900 Subject: [PATCH 06/13] =?UTF-8?q?fix:=20checkstyle=20=EB=B9=88=20=EC=A4=84?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/checkstyle/checkstyle.xml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 761df743..2c837038 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -116,14 +116,18 @@ + + + - - - - + + From 468633dbb4f7b9813fef132e7f9600d933fb52fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 23:24:31 +0900 Subject: [PATCH 07/13] =?UTF-8?q?fix:=20checkstyle=20TODO=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/checkstyle/checkstyle.xml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 2c837038..9030a262 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -136,7 +136,7 @@ - + @@ -238,11 +238,5 @@ - - - - - - From 203048e2a6c6e35c4ff5656d9e8ad4db8894319b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 23:24:46 +0900 Subject: [PATCH 08/13] =?UTF-8?q?chore:=20checkstyle=20=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=BD=94=EB=93=9C=20=ED=8F=AC?= =?UTF-8?q?=EB=A9=A7=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../konect/domain/chat/dto/CreateChatRoomRequest.java | 2 +- .../gg/agit/konect/domain/chat/model/ChatRoom.java | 4 ++-- .../domain/chat/repository/ChatMessageRepository.java | 5 ++++- .../konect/domain/club/model/ClubRecruitment.java | 9 ++++++++- .../domain/club/repository/ClubQueryRepository.java | 4 +++- .../agit/konect/domain/club/service/ClubService.java | 4 +++- .../domain/council/dto/CouncilCreateRequest.java | 5 ++++- .../domain/council/dto/CouncilUpdateRequest.java | 5 ++++- .../konect/domain/notice/service/NoticeService.java | 4 +++- .../domain/schedule/controller/ScheduleApi.java | 1 - .../schedule/controller/ScheduleController.java | 1 - .../konect/domain/schedule/dto/SchedulesResponse.java | 1 + .../agit/konect/domain/user/dto/UserInfoResponse.java | 2 +- .../konect/domain/user/dto/UserUpdateRequest.java | 1 - .../konect/domain/user/model/UnRegisteredUser.java | 6 ++---- .../java/gg/agit/konect/domain/user/model/User.java | 11 +++-------- .../auth/handler/OAuth2LoginSuccessHandler.java | 2 +- .../global/auth/oauth/KakaoOAuthServiceImpl.java | 2 +- .../global/auth/oauth/NaverOAuthServiceImpl.java | 2 +- .../agit/konect/global/config/RestTemplateConfig.java | 7 +++++-- .../gg/agit/konect/global/config/SecurityConfig.java | 4 +++- .../java/gg/agit/konect/global/config/WebConfig.java | 4 +++- .../global/exception/GlobalExceptionHandler.java | 5 ++--- .../konect/global/logging/RequestLoggingFilter.java | 1 - 24 files changed, 55 insertions(+), 37 deletions(-) diff --git a/src/main/java/gg/agit/konect/domain/chat/dto/CreateChatRoomRequest.java b/src/main/java/gg/agit/konect/domain/chat/dto/CreateChatRoomRequest.java index c751d2a0..4664eca5 100644 --- a/src/main/java/gg/agit/konect/domain/chat/dto/CreateChatRoomRequest.java +++ b/src/main/java/gg/agit/konect/domain/chat/dto/CreateChatRoomRequest.java @@ -11,4 +11,4 @@ public record CreateChatRoomRequest( Integer clubId ) { -} \ No newline at end of file +} diff --git a/src/main/java/gg/agit/konect/domain/chat/model/ChatRoom.java b/src/main/java/gg/agit/konect/domain/chat/model/ChatRoom.java index 8dfd6ba2..e89782c9 100644 --- a/src/main/java/gg/agit/konect/domain/chat/model/ChatRoom.java +++ b/src/main/java/gg/agit/konect/domain/chat/model/ChatRoom.java @@ -53,7 +53,7 @@ private ChatRoom(Integer id, User sender, User receiver) { } public static ChatRoom of(User sender, User receiver) { - return ChatRoom.builder() + return ChatRoom.builder() .sender(sender) .receiver(receiver) .build(); @@ -84,7 +84,7 @@ public LocalDateTime getLastMessageTime() { } public Integer getUnreadCount(Integer userId) { - return (int) chatMessages.stream() + return (int)chatMessages.stream() .filter(message -> message.getReceiver().getId().equals(userId)) .filter(message -> !message.getIsRead()) .count(); diff --git a/src/main/java/gg/agit/konect/domain/chat/repository/ChatMessageRepository.java b/src/main/java/gg/agit/konect/domain/chat/repository/ChatMessageRepository.java index df864fb1..570b59c8 100644 --- a/src/main/java/gg/agit/konect/domain/chat/repository/ChatMessageRepository.java +++ b/src/main/java/gg/agit/konect/domain/chat/repository/ChatMessageRepository.java @@ -31,7 +31,10 @@ public interface ChatMessageRepository extends Repository AND cm.receiver.id = :receiverId AND cm.isRead = false """) - List findUnreadMessages(@Param("chatRoomId") Integer chatRoomId, @Param("receiverId") Integer receiverId); + List findUnreadMessages( + @Param("chatRoomId") Integer chatRoomId, + @Param("receiverId") Integer receiverId + ); @Modifying @Query(""" diff --git a/src/main/java/gg/agit/konect/domain/club/model/ClubRecruitment.java b/src/main/java/gg/agit/konect/domain/club/model/ClubRecruitment.java index 20672d94..66c1f61d 100644 --- a/src/main/java/gg/agit/konect/domain/club/model/ClubRecruitment.java +++ b/src/main/java/gg/agit/konect/domain/club/model/ClubRecruitment.java @@ -47,7 +47,14 @@ public class ClubRecruitment extends BaseEntity { private Club club; @Builder - private ClubRecruitment(Integer id, LocalDate startDate, LocalDate endDate, String content, String imageUrl, Club club) { + private ClubRecruitment( + Integer id, + LocalDate startDate, + LocalDate endDate, + String content, + String imageUrl, + Club club + ) { this.id = id; this.startDate = startDate; this.endDate = endDate; diff --git a/src/main/java/gg/agit/konect/domain/club/repository/ClubQueryRepository.java b/src/main/java/gg/agit/konect/domain/club/repository/ClubQueryRepository.java index dfd955f5..d62e1008 100644 --- a/src/main/java/gg/agit/konect/domain/club/repository/ClubQueryRepository.java +++ b/src/main/java/gg/agit/konect/domain/club/repository/ClubQueryRepository.java @@ -33,7 +33,9 @@ public class ClubQueryRepository { private final JPAQueryFactory jpaQueryFactory; - public Page findAllByFilter(PageRequest pageable, String query, Boolean isRecruiting, Integer universityId) { + public Page findAllByFilter( + PageRequest pageable, String query, Boolean isRecruiting, Integer universityId + ) { BooleanBuilder filter = clubSearchFilter(query, isRecruiting, universityId); OrderSpecifier sort = clubSort(isRecruiting); diff --git a/src/main/java/gg/agit/konect/domain/club/service/ClubService.java b/src/main/java/gg/agit/konect/domain/club/service/ClubService.java index d608e28e..6bfe72a7 100644 --- a/src/main/java/gg/agit/konect/domain/club/service/ClubService.java +++ b/src/main/java/gg/agit/konect/domain/club/service/ClubService.java @@ -60,7 +60,9 @@ public class ClubService { public ClubsResponse getClubs(Integer page, Integer limit, String query, Boolean isRecruiting, Integer userId) { User user = userRepository.getById(userId); PageRequest pageable = PageRequest.of(page - 1, limit); - Page clubSummaryInfoPage = clubQueryRepository.findAllByFilter(pageable, query, isRecruiting, user.getUniversity().getId()); + Page clubSummaryInfoPage = clubQueryRepository.findAllByFilter( + pageable, query, isRecruiting, user.getUniversity().getId() + ); return ClubsResponse.of(clubSummaryInfoPage); } diff --git a/src/main/java/gg/agit/konect/domain/council/dto/CouncilCreateRequest.java b/src/main/java/gg/agit/konect/domain/council/dto/CouncilCreateRequest.java index 3f2f4c6a..b93f0776 100644 --- a/src/main/java/gg/agit/konect/domain/council/dto/CouncilCreateRequest.java +++ b/src/main/java/gg/agit/konect/domain/council/dto/CouncilCreateRequest.java @@ -40,7 +40,10 @@ public record CouncilCreateRequest( String phoneNumber, @NotEmpty(message = "총동아리연합회 이메일은 필수 입력입니다.") - @Pattern(regexp = "^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])+[.][a-zA-Z]{2,3}$", message = "이메일 주소 양식을 확인해주세요") + @Pattern( + regexp = "^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])+[.][a-zA-Z]{2,3}$", + message = "이메일 주소 양식을 확인해주세요" + ) @Size(max = 255, message = "총동아리연합회 이메일은 최대 255자 입니다.") @Schema(description = "총동아리연합회 이메일", example = "council@example.com", requiredMode = REQUIRED) String email, diff --git a/src/main/java/gg/agit/konect/domain/council/dto/CouncilUpdateRequest.java b/src/main/java/gg/agit/konect/domain/council/dto/CouncilUpdateRequest.java index da5b7170..02f86e5e 100644 --- a/src/main/java/gg/agit/konect/domain/council/dto/CouncilUpdateRequest.java +++ b/src/main/java/gg/agit/konect/domain/council/dto/CouncilUpdateRequest.java @@ -38,7 +38,10 @@ public record CouncilUpdateRequest( String phoneNumber, @NotEmpty(message = "총동아리연합회 이메일은 필수 입력입니다.") - @Pattern(regexp = "^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])+[.][a-zA-Z]{2,3}$", message = "이메일 주소 양식을 확인해주세요") + @Pattern( + regexp = "^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])+[.][a-zA-Z]{2,3}$", + message = "이메일 주소 양식을 확인해주세요" + ) @Size(max = 255, message = "총동아리연합회 이메일은 최대 255자 입니다.") @Schema(description = "총동아리연합회 이메일", example = "council@example.com", requiredMode = REQUIRED) String email, diff --git a/src/main/java/gg/agit/konect/domain/notice/service/NoticeService.java b/src/main/java/gg/agit/konect/domain/notice/service/NoticeService.java index f096f670..bb1c216a 100644 --- a/src/main/java/gg/agit/konect/domain/notice/service/NoticeService.java +++ b/src/main/java/gg/agit/konect/domain/notice/service/NoticeService.java @@ -43,7 +43,9 @@ public CouncilNoticesResponse getNotices(Integer page, Integer limit, Integer us Council council = councilRepository.getByUniversity(user.getUniversity()); PageRequest pageable = PageRequest.of(page - 1, limit, Sort.by(Sort.Direction.DESC, "createdAt")); Page councilNoticePage = councilNoticeRepository.findByCouncilId(council.getId(), pageable); - Map councilNoticeReadMap = getCouncilNoticeReadMap(user.getId(), councilNoticePage.getContent()); + Map councilNoticeReadMap = getCouncilNoticeReadMap( + user.getId(), councilNoticePage.getContent() + ); return CouncilNoticesResponse.from(councilNoticePage, councilNoticeReadMap); } diff --git a/src/main/java/gg/agit/konect/domain/schedule/controller/ScheduleApi.java b/src/main/java/gg/agit/konect/domain/schedule/controller/ScheduleApi.java index 6d7f6ae8..baaef591 100644 --- a/src/main/java/gg/agit/konect/domain/schedule/controller/ScheduleApi.java +++ b/src/main/java/gg/agit/konect/domain/schedule/controller/ScheduleApi.java @@ -7,7 +7,6 @@ import gg.agit.konect.global.auth.annotation.UserId; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.servlet.http.HttpSession; @Tag(name = "(Normal) Schedule: 일정", description = "일정 API") public interface ScheduleApi { diff --git a/src/main/java/gg/agit/konect/domain/schedule/controller/ScheduleController.java b/src/main/java/gg/agit/konect/domain/schedule/controller/ScheduleController.java index d20c1abc..487ea737 100644 --- a/src/main/java/gg/agit/konect/domain/schedule/controller/ScheduleController.java +++ b/src/main/java/gg/agit/konect/domain/schedule/controller/ScheduleController.java @@ -7,7 +7,6 @@ import gg.agit.konect.domain.schedule.dto.SchedulesResponse; import gg.agit.konect.domain.schedule.service.ScheduleService; import gg.agit.konect.global.auth.annotation.UserId; -import jakarta.servlet.http.HttpSession; import lombok.RequiredArgsConstructor; @RestController diff --git a/src/main/java/gg/agit/konect/domain/schedule/dto/SchedulesResponse.java b/src/main/java/gg/agit/konect/domain/schedule/dto/SchedulesResponse.java index f3c83c7d..261ac885 100644 --- a/src/main/java/gg/agit/konect/domain/schedule/dto/SchedulesResponse.java +++ b/src/main/java/gg/agit/konect/domain/schedule/dto/SchedulesResponse.java @@ -42,6 +42,7 @@ public static InnerScheduleResponse from(UniversitySchedule schedule) { ); } } + public static SchedulesResponse from(List universitySchedules) { return new SchedulesResponse( universitySchedules.stream() diff --git a/src/main/java/gg/agit/konect/domain/user/dto/UserInfoResponse.java b/src/main/java/gg/agit/konect/domain/user/dto/UserInfoResponse.java index 42e87516..37f95088 100644 --- a/src/main/java/gg/agit/konect/domain/user/dto/UserInfoResponse.java +++ b/src/main/java/gg/agit/konect/domain/user/dto/UserInfoResponse.java @@ -26,7 +26,7 @@ public record UserInfoResponse( @Schema(description = "사용자 이메일", example = "2dh2@naver.com", requiredMode = REQUIRED) String email, - @Schema(description = "사용자 프로필 이미지 링크", example = "https://stage-static.koreatech.in/konect/User_02.png",requiredMode = REQUIRED) + @Schema(description = "사용자 프로필 이미지 링크", example = "https://stage-static.koreatech.in/konect/User_02.png", requiredMode = REQUIRED) String imageUrl, @Schema(description = "가입 동아리 개수", example = "1", requiredMode = REQUIRED) diff --git a/src/main/java/gg/agit/konect/domain/user/dto/UserUpdateRequest.java b/src/main/java/gg/agit/konect/domain/user/dto/UserUpdateRequest.java index 148e2eb8..1091cc70 100644 --- a/src/main/java/gg/agit/konect/domain/user/dto/UserUpdateRequest.java +++ b/src/main/java/gg/agit/konect/domain/user/dto/UserUpdateRequest.java @@ -1,6 +1,5 @@ package gg.agit.konect.domain.user.dto; - import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED; import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; diff --git a/src/main/java/gg/agit/konect/domain/user/model/UnRegisteredUser.java b/src/main/java/gg/agit/konect/domain/user/model/UnRegisteredUser.java index 31ad0a86..98c2681f 100644 --- a/src/main/java/gg/agit/konect/domain/user/model/UnRegisteredUser.java +++ b/src/main/java/gg/agit/konect/domain/user/model/UnRegisteredUser.java @@ -12,6 +12,7 @@ import jakarta.persistence.GeneratedValue; import jakarta.persistence.Id; import jakarta.persistence.Table; +import jakarta.persistence.UniqueConstraint; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @@ -21,10 +22,7 @@ @Table( name = "unregistered_user", uniqueConstraints = { - @jakarta.persistence.UniqueConstraint( - name = "uq_unreg_email_provider", - columnNames = {"email", "provider"} - ) + @UniqueConstraint(name = "uq_unreg_email_provider", columnNames = {"email", "provider"}) } ) @NoArgsConstructor(access = PROTECTED) diff --git a/src/main/java/gg/agit/konect/domain/user/model/User.java b/src/main/java/gg/agit/konect/domain/user/model/User.java index f0c86e5e..608061c9 100644 --- a/src/main/java/gg/agit/konect/domain/user/model/User.java +++ b/src/main/java/gg/agit/konect/domain/user/model/User.java @@ -16,6 +16,7 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import jakarta.persistence.Table; +import jakarta.persistence.UniqueConstraint; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; @@ -25,14 +26,8 @@ @Table( name = "users", uniqueConstraints = { - @jakarta.persistence.UniqueConstraint( - name = "uq_reg_email_provider", - columnNames = {"email", "provider"} - ), - @jakarta.persistence.UniqueConstraint( - name = "uq_user_university_student_number", - columnNames = {"university_id", "student_number"} - ) + @UniqueConstraint(name = "uq_reg_email_provider", columnNames = {"email", "provider"}), + @UniqueConstraint(name = "uq_user_university_student_number", columnNames = {"university_id", "student_number"}) } ) @NoArgsConstructor(access = PROTECTED) diff --git a/src/main/java/gg/agit/konect/global/auth/handler/OAuth2LoginSuccessHandler.java b/src/main/java/gg/agit/konect/global/auth/handler/OAuth2LoginSuccessHandler.java index d1515e64..fc5fb07d 100644 --- a/src/main/java/gg/agit/konect/global/auth/handler/OAuth2LoginSuccessHandler.java +++ b/src/main/java/gg/agit/konect/global/auth/handler/OAuth2LoginSuccessHandler.java @@ -28,7 +28,7 @@ public class OAuth2LoginSuccessHandler implements AuthenticationSuccessHandler { @Value("${app.frontend.base-url}") private String frontendBaseUrl; - private final int TEMP_SESSION_EXPIRATION_SECONDS = 600; + private static final int TEMP_SESSION_EXPIRATION_SECONDS = 600; private final UserRepository userRepository; diff --git a/src/main/java/gg/agit/konect/global/auth/oauth/KakaoOAuthServiceImpl.java b/src/main/java/gg/agit/konect/global/auth/oauth/KakaoOAuthServiceImpl.java index 472e5a68..d4015b8c 100644 --- a/src/main/java/gg/agit/konect/global/auth/oauth/KakaoOAuthServiceImpl.java +++ b/src/main/java/gg/agit/konect/global/auth/oauth/KakaoOAuthServiceImpl.java @@ -31,7 +31,7 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic OAuth2User oAuth2User = super.loadUser(userRequest); Map kakaoAccount = oAuth2User.getAttribute("kakao_account"); - String email = (String) kakaoAccount.get("email"); + String email = (String)kakaoAccount.get("email"); String registrationId = userRequest.getClientRegistration().getRegistrationId().toUpperCase(); Provider provider = Provider.valueOf(registrationId); diff --git a/src/main/java/gg/agit/konect/global/auth/oauth/NaverOAuthServiceImpl.java b/src/main/java/gg/agit/konect/global/auth/oauth/NaverOAuthServiceImpl.java index 95f89c5a..94cb778b 100644 --- a/src/main/java/gg/agit/konect/global/auth/oauth/NaverOAuthServiceImpl.java +++ b/src/main/java/gg/agit/konect/global/auth/oauth/NaverOAuthServiceImpl.java @@ -31,7 +31,7 @@ public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2Authentic OAuth2User oAuth2User = super.loadUser(userRequest); Map response = oAuth2User.getAttribute("response"); - String email = (String) response.get("email"); + String email = (String)response.get("email"); String registrationId = userRequest.getClientRegistration().getRegistrationId().toUpperCase(); Provider provider = Provider.valueOf(registrationId); diff --git a/src/main/java/gg/agit/konect/global/config/RestTemplateConfig.java b/src/main/java/gg/agit/konect/global/config/RestTemplateConfig.java index 7e798475..24812c4b 100644 --- a/src/main/java/gg/agit/konect/global/config/RestTemplateConfig.java +++ b/src/main/java/gg/agit/konect/global/config/RestTemplateConfig.java @@ -13,13 +13,16 @@ @Configuration public class RestTemplateConfig { + private static final Integer CONNECT_TIMEOUT = 5000; + private static final Integer READ_TIMEOUT = 5000; + @Bean public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) { return restTemplateBuilder .requestFactory(() -> { SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); - factory.setConnectTimeout(5000); - factory.setReadTimeout(5000); + factory.setConnectTimeout(CONNECT_TIMEOUT); + factory.setReadTimeout(READ_TIMEOUT); return new BufferingClientHttpRequestFactory(factory); }) .additionalMessageConverters(new StringHttpMessageConverter(UTF_8)) diff --git a/src/main/java/gg/agit/konect/global/config/SecurityConfig.java b/src/main/java/gg/agit/konect/global/config/SecurityConfig.java index ef51f5e1..eba23e3f 100644 --- a/src/main/java/gg/agit/konect/global/config/SecurityConfig.java +++ b/src/main/java/gg/agit/konect/global/config/SecurityConfig.java @@ -1,5 +1,7 @@ package gg.agit.konect.global.config; +import static org.springframework.http.HttpStatus.UNAUTHORIZED; + import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; @@ -33,7 +35,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .authorizeHttpRequests(auth -> auth.anyRequest().permitAll()) .exceptionHandling(ex -> ex .authenticationEntryPoint((request, response, authException) -> { - response.sendError(401); + response.sendError(UNAUTHORIZED.value()); }) ).oauth2Login(oauth2 -> oauth2 .userInfoEndpoint(userInfo -> userInfo diff --git a/src/main/java/gg/agit/konect/global/config/WebConfig.java b/src/main/java/gg/agit/konect/global/config/WebConfig.java index 2cf794cb..86dfa187 100644 --- a/src/main/java/gg/agit/konect/global/config/WebConfig.java +++ b/src/main/java/gg/agit/konect/global/config/WebConfig.java @@ -16,6 +16,8 @@ @RequiredArgsConstructor public class WebConfig implements WebMvcConfigurer { + private static final Integer CORS_PREFLIGHT_MAX_AGE_SECONDS = 3600; + private final CorsProperties corsProperties; private final LoginCheckInterceptor loginCheckInterceptor; private final LoginUserArgumentResolver loginUserArgumentResolver; @@ -27,7 +29,7 @@ public void addCorsMappings(CorsRegistry registry) { .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH") .allowedHeaders("*") .allowCredentials(true) - .maxAge(3600); + .maxAge(CORS_PREFLIGHT_MAX_AGE_SECONDS); } @Override diff --git a/src/main/java/gg/agit/konect/global/exception/GlobalExceptionHandler.java b/src/main/java/gg/agit/konect/global/exception/GlobalExceptionHandler.java index ab6ee2ad..26377ff3 100644 --- a/src/main/java/gg/agit/konect/global/exception/GlobalExceptionHandler.java +++ b/src/main/java/gg/agit/konect/global/exception/GlobalExceptionHandler.java @@ -56,7 +56,7 @@ public ResponseEntity handleIllegalStateException() { } @ExceptionHandler(DateTimeException.class) - public ResponseEntity DateTimeException() { + public ResponseEntity dateTimeException() { return buildErrorResponse(ApiResponseCode.INVALID_DATE_TIME); } @@ -238,8 +238,7 @@ private String getRequestBody(HttpServletRequest request) { return " - "; } return new String(buf, wrapper.getCharacterEncoding()); - } catch (Exception e - ) { + } catch (Exception e) { return " - "; } } diff --git a/src/main/java/gg/agit/konect/global/logging/RequestLoggingFilter.java b/src/main/java/gg/agit/konect/global/logging/RequestLoggingFilter.java index 4fb06288..cab5f5d2 100644 --- a/src/main/java/gg/agit/konect/global/logging/RequestLoggingFilter.java +++ b/src/main/java/gg/agit/konect/global/logging/RequestLoggingFilter.java @@ -33,7 +33,6 @@ public class RequestLoggingFilter extends OncePerRequestFilter { private final ObjectProvider pathMatcherProvider; private final LoggingProperties properties; - @Override public void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { From cb004edf924bd8a115d3ccc19461301f7764bfa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 23:31:20 +0900 Subject: [PATCH 09/13] =?UTF-8?q?build:=20checkstyle=20=EC=9B=8C=ED=81=AC?= =?UTF-8?q?=20=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/checkstyle.yml | 79 ++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/checkstyle.yml diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml new file mode 100644 index 00000000..f51557bf --- /dev/null +++ b/.github/workflows/checkstyle.yml @@ -0,0 +1,79 @@ +name: Checkstyle + +on: + pull_request: + branches: + - main + - develop + push: + branches: + - main + - develop + +jobs: + checkstyle: + name: Code Style Check + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + token: ${{ secrets.SUBMODULE_TOKEN }} + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Cache Gradle packages + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Run Checkstyle + run: ./gradlew checkstyleMain checkstyleTest --no-daemon + + - name: Upload Checkstyle Report + if: always() + uses: actions/upload-artifact@v4 + with: + name: checkstyle-report + path: | + build/reports/checkstyle/main.html + build/reports/checkstyle/test.html + build/reports/checkstyle/main.xml + build/reports/checkstyle/test.xml + retention-days: 30 + + - name: Comment PR with Checkstyle Results + if: github.event_name == 'pull_request' && failure() + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + const path = require('path'); + + let comment = '## ⚠️ Checkstyle 위반 사항 발견\n\n'; + comment += 'Checkstyle 검사에서 코딩 컨벤션 위반이 발견되었습니다.\n\n'; + comment += '### 📋 상세 리포트\n'; + comment += '- [Main 소스 리포트 다운로드](../actions/runs/${{ github.run_id }})\n'; + comment += '- [Test 소스 리포트 다운로드](../actions/runs/${{ github.run_id }})\n\n'; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment + }); \ No newline at end of file From 6599a8935bdce6e5731d127ed164ff4fdf24ea49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 23:34:52 +0900 Subject: [PATCH 10/13] =?UTF-8?q?build:=20checkstyle=20=EC=9B=8C=ED=81=AC?= =?UTF-8?q?=20=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/checkstyle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index f51557bf..5459e685 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -42,7 +42,7 @@ jobs: run: chmod +x gradlew - name: Run Checkstyle - run: ./gradlew checkstyleMain checkstyleTest --no-daemon + run: ./gradlew checkstyleMain --no-daemon - name: Upload Checkstyle Report if: always() @@ -76,4 +76,4 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, body: comment - }); \ No newline at end of file + }); From a662e5fbcbdcb0b9a0557e6557a9b67c4eb9cedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 23:35:51 +0900 Subject: [PATCH 11/13] =?UTF-8?q?build:=20checkstyle=20=EC=9B=8C=ED=81=AC?= =?UTF-8?q?=20=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/checkstyle.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index 5459e685..26ec9299 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -51,10 +51,8 @@ jobs: name: checkstyle-report path: | build/reports/checkstyle/main.html - build/reports/checkstyle/test.html build/reports/checkstyle/main.xml - build/reports/checkstyle/test.xml - retention-days: 30 + retention-days: 7 - name: Comment PR with Checkstyle Results if: github.event_name == 'pull_request' && failure() @@ -69,7 +67,6 @@ jobs: comment += 'Checkstyle 검사에서 코딩 컨벤션 위반이 발견되었습니다.\n\n'; comment += '### 📋 상세 리포트\n'; comment += '- [Main 소스 리포트 다운로드](../actions/runs/${{ github.run_id }})\n'; - comment += '- [Test 소스 리포트 다운로드](../actions/runs/${{ github.run_id }})\n\n'; github.rest.issues.createComment({ issue_number: context.issue.number, From 88672d29f98d1a44e0b08cce6fe7de950565e635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 23:38:51 +0900 Subject: [PATCH 12/13] =?UTF-8?q?build:=20checkstyle=20=EC=9B=8C=ED=81=AC?= =?UTF-8?q?=20=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/checkstyle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index 26ec9299..5c26a408 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -45,7 +45,7 @@ jobs: run: ./gradlew checkstyleMain --no-daemon - name: Upload Checkstyle Report - if: always() + if: failure() uses: actions/upload-artifact@v4 with: name: checkstyle-report From c645dc7403eb151b52594b5feea3cae8ce18f90c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EA=B4=80=EA=B7=9C?= Date: Wed, 24 Dec 2025 23:42:13 +0900 Subject: [PATCH 13/13] =?UTF-8?q?fix:=20suppersions=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/checkstyle/suppressions.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml index 3ea5a7d4..5f822928 100644 --- a/config/checkstyle/suppressions.xml +++ b/config/checkstyle/suppressions.xml @@ -10,12 +10,4 @@ - - - - - - - -