Skip to content

Commit c77ed4a

Browse files
authored
Merge pull request #344 from GSM-MSG/343-feat/ktlint-for-code-formatting
🔀 :: 343 feat/ktlint for code formatting
2 parents ffb204d + ef9163b commit c77ed4a

File tree

76 files changed

+157
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+157
-170
lines changed

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 4
8+
insert_final_newline = false
9+
tab_width = 4
10+
11+
[*.kt]
12+
ij_kotlin_packages_to_use_import_on_demand = unset
13+
ij_kotlin_allow_trailing_comma = false
14+
ij_kotlin_allow_trailing_comma_on_call_site = false

build.gradle.kts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ plugins {
44
id("org.springframework.boot") version PluginVersion.SPRING_BOOT_VERSION
55
id("io.spring.dependency-management") version PluginVersion.DEPENDENCY_MANAGER_VERSION
66
id("com.ewerk.gradle.plugins.querydsl") version PluginVersion.QUERY_DSL_PLUGIN_VERSION
7+
id("org.jlleitschuh.gradle.ktlint") version "10.2.0"
78

89
kotlin("jvm") version PluginVersion.JVM_VERSION
910
kotlin("plugin.spring") version PluginVersion.SPRING_PLUGIN_VERSION
1011
kotlin("plugin.jpa") version PluginVersion.JPA_PLUGIN_VERSION
1112
kotlin("kapt") version PluginVersion.KAPT_VERSION
1213
idea
14+
application
1315
}
1416

1517
group = "com.msg"
@@ -78,7 +80,6 @@ dependencies {
7880
implementation(Dependencies.PROMETHEUS_MICROMETER)
7981
}
8082

81-
8283
tasks.withType<KotlinCompile> {
8384
kotlinOptions {
8485
freeCompilerArgs = listOf("-Xjsr305=strict")
@@ -97,3 +98,18 @@ idea {
9798
tasks.withType<Test> {
9899
useJUnitPlatform()
99100
}
101+
102+
application {
103+
mainClass.set("com.msg.gauth.GauthBackendApplicationKt")
104+
}
105+
106+
ktlint {
107+
verbose.set(true)
108+
android.set(false)
109+
outputToConsole.set(true)
110+
coloredOutput.set(false)
111+
ignoreFailures.set(false)
112+
enableExperimentalRules.set(false)
113+
114+
disabledRules.set(setOf("no-wildcard-imports", "import-ordering"))
115+
}

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
rootProject.name = "gauth"
1+
rootProject.name = "gauth"

src/main/kotlin/com/msg/gauth/GauthBackendApplication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ class GauthBackendApplication
1212
fun main(args: Array<String>) {
1313
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Seoul"))
1414
runApplication<GauthBackendApplication>(*args)
15-
}
15+
}

src/main/kotlin/com/msg/gauth/domain/admin/service/ExcelParsingService.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ class ExcelParsingService(
2020
private val userRepository: UserRepository,
2121
) {
2222

23-
fun execute(file: MultipartFile){
23+
fun execute(file: MultipartFile) {
2424
val tika = Tika()
2525
val detect = tika.detect(file.bytes)
2626
val extension = FileNameUtils.getExtension(file.originalFilename)
2727

28-
if(!ExcelUtil.isExcel(detect, extension))
28+
if (!ExcelUtil.isExcel(detect, extension))
2929
throw FileExtensionInvalidException()
3030

3131
val workBook: Workbook =
@@ -34,10 +34,10 @@ class ExcelParsingService(
3434
else
3535
HSSFWorkbook(file.inputStream)
3636

37-
val workSheet:Sheet = workBook.getSheetAt(0)
37+
val workSheet: Sheet = workBook.getSheetAt(0)
3838
val map = hashMapOf<String, UpdateDto>()
3939

40-
for(i in 1 until workSheet.physicalNumberOfRows){
40+
for (i in 1 until workSheet.physicalNumberOfRows) {
4141
val row = workSheet.getRow(i)
4242
val email = row.getCell(4).stringCellValue
4343

src/main/kotlin/com/msg/gauth/domain/auth/handler/AuthEventHandler.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import org.springframework.http.HttpEntity
1010
import org.springframework.http.HttpHeaders
1111
import org.springframework.http.MediaType
1212
import org.springframework.stereotype.Component
13-
import org.springframework.transaction.event.TransactionPhase
14-
import org.springframework.transaction.event.TransactionalEventListener
1513
import org.springframework.web.client.RestTemplate
1614

1715
@Component
@@ -51,4 +49,4 @@ class AuthEventHandler(
5149
val entity = HttpEntity(jsonObject.toString(), headers)
5250
restTemplate.postForObject(discordProperties.url, entity, String::class.java)
5351
}
54-
}
52+
}

src/main/kotlin/com/msg/gauth/domain/auth/presentation/AuthController.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ class AuthController(
6666
return ResponseEntity.ok(result)
6767
}
6868

69-
7069
@PatchMapping("/password/initialize")
7170
fun initPassword(@Valid @RequestBody initPasswordRequestDto: InitPasswordRequestDto): ResponseEntity<Void> {
7271
initPasswordService.execute(initPasswordRequestDto)
@@ -84,5 +83,4 @@ class AuthController(
8483
signUpEmailVerificationService.execute(email)
8584
return ResponseEntity.ok().build()
8685
}
87-
8886
}

src/main/kotlin/com/msg/gauth/domain/auth/presentation/dto/request/SignUpV2RequestDto.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import javax.validation.constraints.NotBlank
44
import javax.validation.constraints.NotNull
55
import javax.validation.constraints.Pattern
66

7-
data class SignUpV2RequestDto (
7+
data class SignUpV2RequestDto(
88
@field:NotBlank
99
@field:Pattern(regexp = "^[a-zA-Z0-9.]+@gsm.hs.kr$")
1010
val email: String,

src/main/kotlin/com/msg/gauth/domain/auth/repository/RefreshTokenRepository.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import com.msg.gauth.global.util.count.auth.RefreshToken
44
import org.springframework.data.repository.CrudRepository
55

66
interface RefreshTokenRepository : CrudRepository<RefreshToken, Long> {
7-
7+
88
fun findByToken(token: String): RefreshToken?
99
}

src/main/kotlin/com/msg/gauth/domain/auth/service/InitPasswordService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class InitPasswordService(
2020
val emailAuth = emailAuthRepository.findByIdOrNull(initPasswordRequestDto.email)
2121
?: throw EmailNotVerifiedException()
2222

23-
if(!emailAuth.authentication)
23+
if (!emailAuth.authentication)
2424
throw EmailNotVerifiedException()
2525

2626
val user = userRepository.findByEmail(initPasswordRequestDto.email)

src/main/kotlin/com/msg/gauth/domain/auth/service/RefreshService.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ class RefreshService(
2828
throw InvalidRefreshTokenException()
2929

3030
val (access, refresh) = jwtTokenProvider.run {
31-
generateAccessToken(email) to generateRefreshToken(email)}
31+
generateAccessToken(email) to generateRefreshToken(email)
32+
}
3233

3334
val newRefreshToken = RefreshToken(
3435
userId = existingRefreshToken.userId,

src/main/kotlin/com/msg/gauth/domain/auth/service/SignInService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class SignInService(
3838
throw PasswordMismatchException()
3939
}
4040

41-
if(user.state == UserState.PENDING)
41+
if (user.state == UserState.PENDING)
4242
throw UserIsPendingException()
4343

4444
tempUserUtil.resetWrongPasswordCount(user)

src/main/kotlin/com/msg/gauth/domain/auth/service/SignUpImageUploadService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ class SignUpImageUploadService(
1818
val emailAuth = emailAuthRepository.findByIdOrNull(email)
1919
?: throw AuthCodeExpiredException()
2020

21-
if(!emailAuth.authentication)
21+
if (!emailAuth.authentication)
2222
throw AuthCodeNotVerificationException()
2323

24-
if(previousUrl != null)
24+
if (previousUrl != null)
2525
s3Util.deleteImage(previousUrl)
2626

2727
return SignUpImageResDto(s3Util.imageUpload(image))

src/main/kotlin/com/msg/gauth/domain/auth/service/SignUpMemberV2Service.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class SignUpMemberV2Service(
2323
) {
2424

2525
fun execute(signUpV2RequestDto: SignUpV2RequestDto) {
26-
if(userRepository.existsByEmail(signUpV2RequestDto.email))
26+
if (userRepository.existsByEmail(signUpV2RequestDto.email))
2727
throw DuplicateEmailException()
2828

2929
if (userRepository.existsByGradeAndClassNumAndNum(signUpV2RequestDto.grade, signUpV2RequestDto.classNum, signUpV2RequestDto.num))

src/main/kotlin/com/msg/gauth/domain/client/presentation/dto/request/ClientUpdateReqDto.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ data class ClientUpdateReqDto(
1818

1919
@Enumerated(EnumType.STRING)
2020
val serviceScope: ServiceScope = ServiceScope.PUBLIC,
21-
21+
2222
val serviceImgUrl: String = ""
2323
) {
2424

src/main/kotlin/com/msg/gauth/domain/client/presentation/dto/response/ClientDetailResDto.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ data class ClientDetailResDto(
1414
val serviceImgUrl: String
1515
) {
1616

17-
constructor(client: Client): this(
17+
constructor(client: Client) : this(
1818
id = client.id,
1919
clientId = client.clientId,
2020
clientSecret = client.clientSecret,

src/main/kotlin/com/msg/gauth/domain/client/presentation/dto/response/ClientRegisterResDto.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ data class ClientRegisterResDto(
1414
val serviceImgUrl: String
1515
) {
1616

17-
constructor(client: Client): this(
17+
constructor(client: Client) : this(
1818
id = client.id,
1919
clientId = client.clientId,
2020
clientSecret = client.clientSecret,

src/main/kotlin/com/msg/gauth/domain/client/presentation/dto/response/ClientResDto.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ data class ClientResDto(
1212
val serviceImgUrl: String
1313
) {
1414

15-
constructor(client: Client): this(
15+
constructor(client: Client) : this(
1616
clientId = client.id,
1717
serviceName = client.serviceName,
1818
serviceUri = client.serviceUri,

src/main/kotlin/com/msg/gauth/domain/client/presentation/dto/response/SingleClientResDto.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ data class SingleClientResDto(
1212
val serviceImgUrl: String
1313
) {
1414

15-
constructor(client: Client): this(
15+
constructor(client: Client) : this(
1616
id = client.id,
1717
clientId = client.clientId,
1818
serviceName = client.serviceName,

src/main/kotlin/com/msg/gauth/domain/client/repository/ClientRepository.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import com.msg.gauth.domain.user.User
66
import org.springframework.data.domain.Page
77
import org.springframework.data.domain.Pageable
88
import org.springframework.data.jpa.repository.JpaRepository
9-
import org.springframework.data.jpa.repository.Query
109
import java.util.*
1110

1211
interface ClientRepository : JpaRepository<Client, Long>, CustomClientRepository {

src/main/kotlin/com/msg/gauth/domain/client/repository/CustomClientRepositoryImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import org.springframework.stereotype.Repository
88
@Repository
99
class CustomClientRepositoryImpl(
1010
private val jpaQueryFactory: JPAQueryFactory
11-
): CustomClientRepository {
11+
) : CustomClientRepository {
1212

1313
override fun deleteAllByIdsAndCreatedBy(ids: List<Long>, createdBy: User) {
1414
jpaQueryFactory.delete(client)

src/main/kotlin/com/msg/gauth/domain/client/service/DelegateOwnerService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class DelegateOwnerService(
2424
val user = userUtil.fetchCurrentUser()
2525

2626
if (delegateUserId == user.id)
27-
throw BadDelegateUserIdRequestException()
27+
throw BadDelegateUserIdRequestException()
2828

2929
val client = clientRepository.findByIdOrNull(clientId)
3030
?: throw ClientNotFindException()

src/main/kotlin/com/msg/gauth/domain/client/service/DeleteClientService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ class DeleteClientService(
1313
private val userUtil: UserUtil,
1414
) {
1515

16-
fun execute(id: Long){
16+
fun execute(id: Long) {
1717
val client = clientRepository.findByIdOrNull(id)
1818
?: throw ClientNotFindException()
1919

20-
if(client.createdBy != userUtil.fetchCurrentUser())
20+
if (client.createdBy != userUtil.fetchCurrentUser())
2121
throw UserNotMatchException()
2222

2323
clientRepository.delete(client)

src/main/kotlin/com/msg/gauth/domain/client/service/UpdateClientService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class UpdateClientService(
1212
private val userUtil: UserUtil
1313
) {
1414

15-
fun updateClient(id: Long, clientUpdateReqDto: ClientUpdateReqDto){
15+
fun updateClient(id: Long, clientUpdateReqDto: ClientUpdateReqDto) {
1616
val client = clientRepository.findByIdAndCreatedBy(id, userUtil.fetchCurrentUser())
1717
?: throw ClientNotFindException()
1818

src/main/kotlin/com/msg/gauth/domain/email/EmailAuthEntity.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.msg.gauth.domain.email
22

3-
import org.hibernate.annotations.ColumnDefault
43
import org.hibernate.validator.constraints.Length
54
import org.springframework.data.annotation.Id
65
import org.springframework.data.redis.core.RedisHash
@@ -30,7 +29,7 @@ class EmailAuthEntity(
3029
return EmailAuthEntity(
3130
email = this.email,
3231
authentication = this.authentication,
33-
attemptCount = this.attemptCount+1,
32+
attemptCount = this.attemptCount + 1,
3433
randomValue = uuid,
3534
)
3635
}

src/main/kotlin/com/msg/gauth/domain/email/presentation/EmailController.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,4 @@ class EmailController(
3333
checkMailVerificationService.execute(email)
3434
return ResponseEntity.ok().build()
3535
}
36-
3736
}

src/main/kotlin/com/msg/gauth/domain/email/service/CheckMailVerificationService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CheckMailVerificationService(
1414
val authEntity = emailAuthRepository.findByIdOrNull(email)
1515
?: throw AuthCodeNotVerificationException()
1616

17-
if(!authEntity.authentication)
17+
if (!authEntity.authentication)
1818
throw AuthCodeNotVerificationException()
1919
}
2020
}

src/main/kotlin/com/msg/gauth/domain/email/service/SendMailService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class SendMailService(
3535
attemptCount = 0
3636
)
3737

38-
if(authEntity.authentication)
38+
if (authEntity.authentication)
3939
throw AlreadyAuthenticatedEmailException()
4040

4141
if (authEntity.attemptCount >= 5)
@@ -65,7 +65,7 @@ class SendMailService(
6565
private fun createMailTemplate(email: String, code: String): String {
6666
val context = Context()
6767

68-
val url = "https://port-0-gauth-backend-85phb42bluutn9a7.sel5.cloudtype.app/email/authentication?email=${email}&uuid=${code}"
68+
val url = "https://port-0-gauth-backend-85phb42bluutn9a7.sel5.cloudtype.app/email/authentication?email=$email&uuid=$code"
6969

7070
context.setVariables(
7171
mapOf(

src/main/kotlin/com/msg/gauth/domain/oauth/exception/UserStatePendingException.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ package com.msg.gauth.domain.oauth.exception
33
import com.msg.gauth.global.exception.ErrorCode
44
import com.msg.gauth.global.exception.exceptions.BasicException
55

6-
class UserStatePendingException: BasicException(
6+
class UserStatePendingException : BasicException(
77
ErrorCode.USER_STATE_PENDING
88
)

src/main/kotlin/com/msg/gauth/domain/oauth/presentation/OauthController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class OauthController(
2323
) {
2424

2525
@PostMapping("/code")
26-
fun generateOauthCode(@Valid @RequestBody oauthCodeRequestDto : OauthCodeRequestDto): ResponseEntity<OauthCodeResponseDto> {
26+
fun generateOauthCode(@Valid @RequestBody oauthCodeRequestDto: OauthCodeRequestDto): ResponseEntity<OauthCodeResponseDto> {
2727
val result = generateOauthCodeService.execute(oauthCodeRequestDto)
2828
return ResponseEntity.ok(result)
2929
}

src/main/kotlin/com/msg/gauth/domain/oauth/presentation/dto/request/OauthLoginReqDto.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ data class OauthLoginReqDto(
1313

1414
@field:NotBlank
1515
val password: String
16-
)
16+
)

src/main/kotlin/com/msg/gauth/domain/oauth/service/GenerateOauthCodeService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class GenerateOauthCodeService(
3939
throw PasswordMismatchException()
4040
}
4141

42-
if(user.state == UserState.PENDING)
42+
if (user.state == UserState.PENDING)
4343
throw UserStatePendingException()
4444

4545
tempUserUtil.resetOAuthWrongPasswordCount(user)
@@ -58,7 +58,7 @@ class GenerateOauthCodeService(
5858
tempUserUtil.isUserBan(user)
5959
tooManyOAuthRequestValidUtil.validRequest(user.email)
6060

61-
if(user.state == UserState.PENDING)
61+
if (user.state == UserState.PENDING)
6262
throw UserStatePendingException()
6363

6464
val code = UUID.randomUUID().toString().split(".")[0]

0 commit comments

Comments
 (0)