From 33b72e4c76e9b4956799e7787ba6e7dc75a65777 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Mon, 22 May 2023 15:20:15 +0900 Subject: [PATCH] =?UTF-8?q?style:=20=E3=82=B9=E3=82=BF=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- detekt.yml | 2 +- .../dev/usbharu/hideout/domain/model/ap/Accept.kt | 7 +------ .../dev/usbharu/hideout/domain/model/ap/Follow.kt | 6 +----- .../hideout/domain/model/ap/ObjectDeserializer.kt | 1 - .../dev/usbharu/hideout/domain/model/ap/ObjectValue.kt | 10 +++------- .../kotlin/dev/usbharu/hideout/domain/model/ap/Undo.kt | 10 +++------- .../service/activitypub/ActivityPubUndoServiceImpl.kt | 1 - 7 files changed, 9 insertions(+), 28 deletions(-) diff --git a/detekt.yml b/detekt.yml index d0f97bdc..bf483322 100644 --- a/detekt.yml +++ b/detekt.yml @@ -92,7 +92,7 @@ exceptions: active: true NotImplementedDeclaration: - active: true + active: false ObjectExtendsThrowable: active: true diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Accept.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Accept.kt index 487a31d6..e25d0e6d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Accept.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Accept.kt @@ -20,10 +20,7 @@ open class Accept : Object { this.`object` = `object` } - - override fun toString(): String { - return "Accept(`object`=$`object`) ${super.toString()}" - } + override fun toString(): String = "Accept(`object`=$`object`) ${super.toString()}" override fun equals(other: Any?): Boolean { if (this === other) return true @@ -38,6 +35,4 @@ open class Accept : Object { result = 31 * result + (`object`?.hashCode() ?: 0) return result } - - } diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Follow.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Follow.kt index cc7ae0e6..d15d7631 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Follow.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Follow.kt @@ -31,9 +31,5 @@ open class Follow : Object { return result } - override fun toString(): String { - return "Follow(`object`=$`object`) ${super.toString()}" - } - - + override fun toString(): String = "Follow(`object`=$`object`) ${super.toString()}" } diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectDeserializer.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectDeserializer.kt index c142d1f9..70bcee3b 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectDeserializer.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectDeserializer.kt @@ -45,5 +45,4 @@ class ObjectDeserializer : JsonDeserializer() { TODO() } } - } diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectValue.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectValue.kt index 978e7db4..635d560d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectValue.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/ObjectValue.kt @@ -1,10 +1,10 @@ package dev.usbharu.hideout.domain.model.ap -class ObjectValue : Object { +open class ObjectValue : Object { var `object`: String? = null - protected constructor() + protected constructor() : super() constructor(type: List, name: String?, actor: String?, id: String?, `object`: String?) : super( type, name, @@ -28,9 +28,5 @@ class ObjectValue : Object { return result } - override fun toString(): String { - return "ObjectValue(`object`=$`object`) ${super.toString()}" - } - - + override fun toString(): String = "ObjectValue(`object`=$`object`) ${super.toString()}" } diff --git a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Undo.kt b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Undo.kt index 804e5060..8a175f22 100644 --- a/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Undo.kt +++ b/src/main/kotlin/dev/usbharu/hideout/domain/model/ap/Undo.kt @@ -3,13 +3,13 @@ package dev.usbharu.hideout.domain.model.ap import com.fasterxml.jackson.databind.annotation.JsonDeserialize import java.time.Instant -class Undo : Object { +open class Undo : Object { @JsonDeserialize(using = ObjectDeserializer::class) var `object`: Object? = null var published: String? = null - protected constructor() + protected constructor() : super() constructor( type: List = emptyList(), name: String, @@ -38,9 +38,5 @@ class Undo : Object { return result } - override fun toString(): String { - return "Undo(`object`=$`object`, published=$published) ${super.toString()}" - } - - + override fun toString(): String = "Undo(`object`=$`object`, published=$published) ${super.toString()}" } diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUndoServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUndoServiceImpl.kt index be826cc1..d8bf3e5d 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUndoServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubUndoServiceImpl.kt @@ -14,7 +14,6 @@ class ActivityPubUndoServiceImpl( private val activityPubUserService: ActivityPubUserService ) : ActivityPubUndoService { override suspend fun receiveUndo(undo: Undo): ActivityPubResponse { - if (undo.actor == null) { return ActivityPubStringResponse(HttpStatusCode.BadRequest, "actor is null") }