From 23c830f390d6788b00fe5721c7944ecee8756b48 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Sat, 24 Feb 2024 14:25:59 +0900 Subject: [PATCH] style: fix lint --- .../hideout/application/config/SecurityConfig.kt | 1 - .../mastodon/domain/exception/ClientException.kt | 2 +- .../domain/exception/MastodonApiException.kt | 2 +- .../mastodon/domain/exception/ServerException.kt | 2 +- .../domain/exception/StatusNotFoundException.kt | 15 ++++++++------- .../domain/model/MastodonApiErrorResponse.kt | 2 +- .../springweb/MastodonApiControllerAdvice.kt | 4 ++-- .../api/status/MastodonStatusesApiContoller.kt | 1 - .../mastodon/service/status/StatusesApiService.kt | 2 -- 9 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/application/config/SecurityConfig.kt b/src/main/kotlin/dev/usbharu/hideout/application/config/SecurityConfig.kt index 5b7bbf73..f53c9cf8 100644 --- a/src/main/kotlin/dev/usbharu/hideout/application/config/SecurityConfig.kt +++ b/src/main/kotlin/dev/usbharu/hideout/application/config/SecurityConfig.kt @@ -92,7 +92,6 @@ import java.security.interfaces.RSAPrivateKey import java.security.interfaces.RSAPublicKey import java.util.* - @EnableWebSecurity(debug = false) @Configuration @Suppress("FunctionMaxLength", "TooManyFunctions", "LongMethod") diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ClientException.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ClientException.kt index 189428b1..3414889a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ClientException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ClientException.kt @@ -35,4 +35,4 @@ open class ClientException : MastodonApiException { writableStackTrace: Boolean, response: MastodonApiErrorResponse<*>, ) : super(message, cause, enableSuppression, writableStackTrace, response) -} \ No newline at end of file +} diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/MastodonApiException.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/MastodonApiException.kt index 5c7289a5..4a13854a 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/MastodonApiException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/MastodonApiException.kt @@ -52,4 +52,4 @@ abstract class MastodonApiException : RuntimeException { ) { this.response = response } -} \ No newline at end of file +} diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ServerException.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ServerException.kt index 5498ab4d..d2d6b187 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ServerException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/ServerException.kt @@ -18,4 +18,4 @@ package dev.usbharu.hideout.mastodon.domain.exception import dev.usbharu.hideout.mastodon.domain.model.MastodonApiErrorResponse -open class ServerException(response: MastodonApiErrorResponse<*>) : MastodonApiException(response) \ No newline at end of file +open class ServerException(response: MastodonApiErrorResponse<*>) : MastodonApiException(response) diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/StatusNotFoundException.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/StatusNotFoundException.kt index 8197434a..934403ec 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/StatusNotFoundException.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/exception/StatusNotFoundException.kt @@ -21,19 +21,16 @@ import dev.usbharu.hideout.mastodon.domain.model.MastodonApiErrorResponse class StatusNotFoundException : ClientException { - fun getTypedResponse(): MastodonApiErrorResponse { - return response as MastodonApiErrorResponse - } - constructor(response: MastodonApiErrorResponse) : super(response) + constructor(message: String?, response: MastodonApiErrorResponse) : super(message, response) constructor(message: String?, cause: Throwable?, response: MastodonApiErrorResponse) : super( message, cause, response ) - constructor(cause: Throwable?, response: MastodonApiErrorResponse) : super(cause, response) + constructor( message: String?, cause: Throwable?, @@ -42,14 +39,18 @@ class StatusNotFoundException : ClientException { response: MastodonApiErrorResponse, ) : super(message, cause, enableSuppression, writableStackTrace, response) + fun getTypedResponse(): MastodonApiErrorResponse = + response as MastodonApiErrorResponse + companion object { fun ofId(id: Long): StatusNotFoundException = StatusNotFoundException( "id: $id was not found.", MastodonApiErrorResponse( NotFoundResponse( "Record not found" - ), 404 + ), + 404 ), ) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/model/MastodonApiErrorResponse.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/model/MastodonApiErrorResponse.kt index 63935050..ee19ebcf 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/model/MastodonApiErrorResponse.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/domain/model/MastodonApiErrorResponse.kt @@ -16,4 +16,4 @@ package dev.usbharu.hideout.mastodon.domain.model -data class MastodonApiErrorResponse(val response: R, val statusCode: Int) \ No newline at end of file +data class MastodonApiErrorResponse(val response: R, val statusCode: Int) diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/springweb/MastodonApiControllerAdvice.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/springweb/MastodonApiControllerAdvice.kt index d2ca2c6a..003b071f 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/springweb/MastodonApiControllerAdvice.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/infrastructure/springweb/MastodonApiControllerAdvice.kt @@ -85,7 +85,7 @@ class MastodonApiControllerAdvice { } val message = details.map { - it.key + " " + it.value.joinToString { it.description } + it.key + " " + it.value.joinToString { responseDetails -> responseDetails.description } }.joinToString() return ResponseEntity.unprocessableEntity() @@ -101,4 +101,4 @@ class MastodonApiControllerAdvice { companion object { private val logger = LoggerFactory.getLogger(MastodonApiControllerAdvice::class.java) } -} \ No newline at end of file +} diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/MastodonStatusesApiContoller.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/MastodonStatusesApiContoller.kt index 0edd2d35..20858ec6 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/MastodonStatusesApiContoller.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/interfaces/api/status/MastodonStatusesApiContoller.kt @@ -43,7 +43,6 @@ class MastodonStatusesApiContoller( ) } - override suspend fun apiV1StatusesIdEmojiReactionsEmojiDelete(id: String, emoji: String): ResponseEntity { val uid = loginUserContextHolder.getLoginUserId() diff --git a/src/main/kotlin/dev/usbharu/hideout/mastodon/service/status/StatusesApiService.kt b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/status/StatusesApiService.kt index 1c9e8d7b..07ae96c8 100644 --- a/src/main/kotlin/dev/usbharu/hideout/mastodon/service/status/StatusesApiService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/mastodon/service/status/StatusesApiService.kt @@ -161,8 +161,6 @@ class StatsesApiServiceImpl( status: Status, userId: Long?, ): Status { - - return when (status.visibility) { public -> status unlisted -> status