Merge pull request #84 from usbharu/feature/fix-lint

Feature/fix lint
This commit is contained in:
usbharu 2023-10-12 11:20:21 +09:00 committed by GitHub
commit 6b9ae48eb1
5 changed files with 12 additions and 7 deletions

View File

@ -42,6 +42,7 @@ import java.util.*
@EnableWebSecurity(debug = false) @EnableWebSecurity(debug = false)
@Configuration @Configuration
@Suppress("FunctionMaxLength ")
class SecurityConfig { class SecurityConfig {
@Bean @Bean

View File

@ -47,13 +47,12 @@ abstract class UserDetailsMixin
class UserDetailsDeserializer : JsonDeserializer<UserDetailsImpl>() { class UserDetailsDeserializer : JsonDeserializer<UserDetailsImpl>() {
private val SIMPLE_GRANTED_AUTHORITY_SET = object : TypeReference<Set<SimpleGrantedAuthority>>() {}
override fun deserialize(p: JsonParser, ctxt: DeserializationContext): UserDetailsImpl { override fun deserialize(p: JsonParser, ctxt: DeserializationContext): UserDetailsImpl {
val mapper = p.codec as ObjectMapper val mapper = p.codec as ObjectMapper
val jsonNode: JsonNode = mapper.readTree(p) val jsonNode: JsonNode = mapper.readTree(p)
val authorities: Set<GrantedAuthority> = mapper.convertValue( val authorities: Set<GrantedAuthority> = mapper.convertValue(
jsonNode["authorities"], jsonNode["authorities"],
SIMPLE_GRANTED_AUTHORITY_SET Companion.SIMPLE_GRANTED_AUTHORITY_SET
) )
val password = jsonNode.readText("password") val password = jsonNode.readText("password")
@ -75,4 +74,8 @@ class UserDetailsDeserializer : JsonDeserializer<UserDetailsImpl>() {
else -> defaultValue else -> defaultValue
} }
} }
companion object {
private val SIMPLE_GRANTED_AUTHORITY_SET = object : TypeReference<Set<SimpleGrantedAuthority>>() {}
}
} }

View File

@ -3,7 +3,7 @@ package dev.usbharu.hideout.domain.model.mastodon
import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonProperty
import dev.usbharu.hideout.domain.mastodon.model.generated.StatusesRequestPoll import dev.usbharu.hideout.domain.mastodon.model.generated.StatusesRequestPoll
@Suppress("VariableNaming") @Suppress("VariableNaming", "EnumEntryName")
class StatusesRequest { class StatusesRequest {
@JsonProperty("status") @JsonProperty("status")
var status: String? = null var status: String? = null

View File

@ -219,9 +219,12 @@ class APServiceImpl(
} }
} }
@Suppress("REDUNDANT_ELSE_IN_WHEN")
override suspend fun <T : HideoutJob> processActivity(job: JobContextWithProps<T>, hideoutJob: HideoutJob) { override suspend fun <T : HideoutJob> processActivity(job: JobContextWithProps<T>, hideoutJob: HideoutJob) {
logger.debug("processActivity: ${hideoutJob.name}") logger.debug("processActivity: ${hideoutJob.name}")
@Suppress("ElseCaseInsteadOfExhaustiveWhen")
// Springで作成されるプロキシの都合上パターンマッチングが壊れるので必須
when (hideoutJob) { when (hideoutJob) {
is ReceiveFollowJob -> { is ReceiveFollowJob -> {
apReceiveFollowService.receiveFollowJob( apReceiveFollowService.receiveFollowJob(

View File

@ -17,8 +17,7 @@ object HttpUtil {
fun isContentTypeOfActivityPub( fun isContentTypeOfActivityPub(
contentType: String, contentType: String,
subType: String, subType: String
parameter: String
): Boolean { ): Boolean {
if (contentType != "application") { if (contentType != "application") {
return false return false
@ -32,8 +31,7 @@ object HttpUtil {
fun isContentTypeOfActivityPub(contentType: ContentType): Boolean { fun isContentTypeOfActivityPub(contentType: ContentType): Boolean {
return isContentTypeOfActivityPub( return isContentTypeOfActivityPub(
contentType.contentType, contentType.contentType,
contentType.contentSubtype, contentType.contentSubtype
contentType.parameter("profile").orEmpty()
) )
} }
// fun // fun