Skip to content

Commit

Permalink
chore: ktlint
Browse files Browse the repository at this point in the history
  • Loading branch information
sm9171 committed Oct 9, 2023
1 parent 2b7aee9 commit d46ba60
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class StoreCreateService(
) {

Check failure on line 20 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/application/StoreCreateService.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/application/StoreCreateService.kt#L20 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/application/StoreCreateService.kt:20:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
@Transactional
fun createStore(request: CreateStoreRequest): CreateStoreResponse{
fun createStore(request: CreateStoreRequest): CreateStoreResponse {
val user = userReader.findById(request.userId) ?: throw IllegalArgumentException()

if (!user.userType.equals(UserType.SELLER)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional

@Service
class StoreReadService (
class StoreReadService(
private val storeReader: StoreReader,
private val userReader: UserReader,
){
) {
@Transactional(readOnly = true)
fun getStoresByUserId(userId: String): List<GetStoresByUserIdResponse> {
val user = userReader.findById(userId) ?: throw IllegalArgumentException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ import com.hanghae.commerce.store.presentation.dto.*
import org.springframework.web.bind.annotation.*

Check failure on line 6 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L6 <standard:no-wildcard-imports>

Wildcard import
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:6:1: error: Wildcard import (standard:no-wildcard-imports)

@RestController
class StoreController (
class StoreController(
private val storeCreateService: StoreCreateService,
private val storeReadService: StoreReadService,
){
) {
@PostMapping("/store")
fun createStore(@RequestBody request: CreateStoreRequest) : CreateStoreResponse {
fun createStore(@RequestBody request: CreateStoreRequest): CreateStoreResponse {

Check failure on line 14 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L14 <standard:parameter-list-wrapping>

Parameter should start on a newline
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:14:21: error: Parameter should start on a newline (standard:parameter-list-wrapping)

Check failure on line 14 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L14 <standard:function-signature>

Newline expected after opening parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:14:21: error: Newline expected after opening parenthesis (standard:function-signature)

Check failure on line 14 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L14 <standard:parameter-list-wrapping>

Missing newline before ")"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:14:61: error: Missing newline before ")" (standard:parameter-list-wrapping)

Check failure on line 14 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L14 <standard:function-signature>

Newline expected before closing parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:14:61: error: Newline expected before closing parenthesis (standard:function-signature)
return storeCreateService.createStore(request)
}

@GetMapping("/store")
fun getStore(@RequestBody request: GetStoreRequest) : GetStoreResponse {
fun getStore(@RequestBody request: GetStoreRequest): GetStoreResponse {

Check failure on line 19 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L19 <standard:parameter-list-wrapping>

Parameter should start on a newline
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:19:18: error: Parameter should start on a newline (standard:parameter-list-wrapping)

Check failure on line 19 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L19 <standard:function-signature>

Newline expected after opening parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:19:18: error: Newline expected after opening parenthesis (standard:function-signature)

Check failure on line 19 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L19 <standard:parameter-list-wrapping>

Missing newline before ")"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:19:55: error: Missing newline before ")" (standard:parameter-list-wrapping)

Check failure on line 19 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L19 <standard:function-signature>

Newline expected before closing parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:19:55: error: Newline expected before closing parenthesis (standard:function-signature)
return storeReadService.getStore(request.storeId)
}

@GetMapping("/stores")
fun getStoresByUserId(@RequestBody request: GetStoresByUserIdRequest) : List<GetStoresByUserIdResponse> {
fun getStoresByUserId(@RequestBody request: GetStoresByUserIdRequest): List<GetStoresByUserIdResponse> {

Check failure on line 24 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L24 <standard:parameter-list-wrapping>

Parameter should start on a newline
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:24:27: error: Parameter should start on a newline (standard:parameter-list-wrapping)

Check failure on line 24 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L24 <standard:function-signature>

Newline expected after opening parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:24:27: error: Newline expected after opening parenthesis (standard:function-signature)

Check failure on line 24 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L24 <standard:parameter-list-wrapping>

Missing newline before ")"
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:24:73: error: Missing newline before ")" (standard:parameter-list-wrapping)

Check failure on line 24 in commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt#L24 <standard:function-signature>

Newline expected before closing parenthesis
Raw output
commerce-api/src/main/kotlin/com/hanghae/commerce/store/presentation/StoreController.kt:24:73: error: Newline expected before closing parenthesis (standard:function-signature)
return storeReadService.getStoresByUserId(request.userId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ package com.hanghae.commerce.store.presentation.dto
data class CreateStoreRequest(
val userId: String,
val name: String,
) {
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.hanghae.commerce.store.presentation.dto

import com.hanghae.commerce.store.domain.Store

data class CreateStoreResponse (
data class CreateStoreResponse(
val id: String,
val name: String,
val userId: String,
){
) {
companion object {
fun of(store: Store): CreateStoreResponse {
return CreateStoreResponse(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.hanghae.commerce.store.presentation.dto

data class GetStoreRequest (
data class GetStoreRequest(
val storeId: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.hanghae.commerce.store.presentation.dto

import com.hanghae.commerce.store.domain.Store

data class GetStoreResponse (
data class GetStoreResponse(
val id: String,
val name: String,
val userId: String,
){
) {
companion object {
fun of(store: Store): GetStoreResponse {
return GetStoreResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.hanghae.commerce.store.presentation.dto

import com.hanghae.commerce.store.domain.Store

data class GetStoresByUserIdResponse (
data class GetStoresByUserIdResponse(
val id: String,
val name: String,
val userId: String,
){
) {
companion object {
fun listOf(stores: List<Store>): List<GetStoresByUserIdResponse> {
return stores.map { store ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.junit.jupiter.api.assertThrows
import org.springframework.beans.factory.annotation.Autowired

@IntegrationTest
class StoreCreateServiceTest (
class StoreCreateServiceTest(
@Autowired
private val storeCreateService: StoreCreateService,
@Autowired
Expand All @@ -23,7 +23,7 @@ class StoreCreateServiceTest (
private val userReader: UserReader,
@Autowired
private val userWriter: UserWriter,
){
) {
@AfterEach
fun tearDown() {
userWriter.allDelete()
Expand All @@ -39,7 +39,7 @@ class StoreCreateServiceTest (
age = 20,
email = "hanghae@naver.com",
address = "seoul",
UserType.SELLER
UserType.SELLER,
)

userWriter.save(user)
Expand Down Expand Up @@ -68,7 +68,7 @@ class StoreCreateServiceTest (
age = 20,
email = "hanghae@naver.com",
address = "seoul",
UserType.SELLER
UserType.SELLER,
)

userWriter.save(user)
Expand Down Expand Up @@ -103,7 +103,7 @@ class StoreCreateServiceTest (
age = 20,
email = "hanghae@naver.com",
address = "seoul",
UserType.CUSTOMER
UserType.CUSTOMER,
)

userWriter.save(user)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired

@IntegrationTest
class StoreReadServiceTest (
class StoreReadServiceTest(
@Autowired
private val storeReadService: StoreReadService,
@Autowired
private val storeWriter: StoreWriter,
@Autowired
private val userWriter: UserWriter,

Check failure on line 22 in commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt#L22 <standard:no-blank-line-in-list>

Unexpected blank line(s) in value parameter list
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt:22:1: error: Unexpected blank line(s) in value parameter list (standard:no-blank-line-in-list)
){
) {

Check failure on line 24 in commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt#L24 <standard:no-empty-first-line-in-class-body>

Class body should not start with blank line
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt:24:1: error: Class body should not start with blank line (standard:no-empty-first-line-in-class-body)
@AfterEach
fun tearDown() {
Expand All @@ -30,7 +30,6 @@ class StoreReadServiceTest (

@Test
fun getStoresByUserId() {

val user = userWriter.save(

Check failure on line 33 in commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt#L33 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt:33:20: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
User(
id = "1",
Expand All @@ -39,23 +38,23 @@ class StoreReadServiceTest (
email = "hanghae@gmail.com",
address = "seoul",
userType = UserType.SELLER,
)
),
)

storeWriter.save(
Store(
id = "1",
name = "상점1",
"1"
)
"1",
),
)

storeWriter.save(
Store(
id = "2",
name = "상점2",
"1"
)
"1",
),
)
val results = storeReadService.getStoresByUserId(user.id)

Expand All @@ -70,7 +69,6 @@ class StoreReadServiceTest (

@Test
fun getStore() {

userWriter.save(
User(
id = "1",
Expand All @@ -79,15 +77,15 @@ class StoreReadServiceTest (
email = "hanghae@gmail.com",
address = "seoul",
userType = UserType.SELLER,
)
),
)

val store = storeWriter.save(

Check failure on line 83 in commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt#L83 <standard:multiline-expression-wrapping>

A multiline expression should start on a new line
Raw output
commerce-api/src/test/kotlin/com/hanghae/commerce/store/application/StoreReadServiceTest.kt:83:21: error: A multiline expression should start on a new line (standard:multiline-expression-wrapping)
Store(
id = "1",
name = "상점1",
"1"
)
"1",
),
)

val result = storeReadService.getStore(store.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.springframework.data.jpa.repository.Query

interface JpaStoreRepository : JpaRepository<StoreEntity, String> {
@Query("select count (s.id) from StoreEntity s where s.name = :name")
fun countSameStoreName (name : String): Int
fun countSameStoreName(name: String): Int

@Query("select s from StoreEntity s where s.userId = :userId")
fun findStoresByUserId(userId: String): List<StoreEntity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class StoreEntityRepository(

override fun findStoresByUserId(userId: String): List<Store> {
val ㅇㅇ = jpaStoreRepository.findStoresByUserId(userId).get(0)

Check failure on line 29 in commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/store/StoreEntityRepository.kt

View workflow job for this annotation

GitHub Actions / ktlint

[ktlint] commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/store/StoreEntityRepository.kt#L29 <standard:property-naming>

Property name should start with a lowercase letter and use camel case
Raw output
commerce-infra/db-main/src/main/kotlin/com/hanghae/commerce/data/domain/store/StoreEntityRepository.kt:29:13: error: Property name should start with a lowercase letter and use camel case (standard:property-naming)
return jpaStoreRepository.findStoresByUserId(userId).map { storeEntity -> storeEntity.toDomain()}
return jpaStoreRepository.findStoresByUserId(userId).map { storeEntity -> storeEntity.toDomain() }
}
}

0 comments on commit d46ba60

Please sign in to comment.