mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-04 20:01:55 +00:00
Do not report detekt LargeClass issues on test classes (#7713)
detekt's default configuration excludes test source sets from
`TooManyFunctions` and `StringLiteralDuplication`, but not from
`LargeClass`, so large test classes were reported and had to carry a
`@Suppress("LargeClass")` annotation.
Add the same kind of exclusion to the `LargeClass` rule in
`tools/detekt/detekt.yml` and remove the 24 now-redundant suppressions
from test files. The two remaining suppressions are in production code,
where the rule still applies.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
-1
@@ -91,7 +91,6 @@ import org.junit.Rule
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class RoomListPresenterTest {
|
class RoomListPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|||||||
-1
@@ -59,7 +59,6 @@ import kotlinx.coroutines.test.runTest
|
|||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
internal class DefaultInvitePeoplePresenterTest {
|
internal class DefaultInvitePeoplePresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|||||||
-1
@@ -70,7 +70,6 @@ import org.junit.Rule
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.util.Optional
|
import java.util.Optional
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class JoinRoomPresenterTest {
|
class JoinRoomPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|||||||
-1
@@ -125,7 +125,6 @@ import org.junit.Test
|
|||||||
import kotlin.time.Duration.Companion.milliseconds
|
import kotlin.time.Duration.Companion.milliseconds
|
||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class MessagesPresenterTest {
|
class MessagesPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|||||||
-1
@@ -90,7 +90,6 @@ import org.junit.Test
|
|||||||
import org.robolectric.annotation.Config
|
import org.robolectric.annotation.Config
|
||||||
import kotlin.time.Duration.Companion.milliseconds
|
import kotlin.time.Duration.Companion.milliseconds
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class MessagesViewTest : RobolectricTest() {
|
class MessagesViewTest : RobolectricTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `clicking on back invoke expected callback`() = runAndroidComposeUiTest {
|
fun `clicking on back invoke expected callback`() = runAndroidComposeUiTest {
|
||||||
|
|||||||
-1
@@ -54,7 +54,6 @@ import kotlinx.coroutines.test.runTest
|
|||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class ActionListPresenterTest {
|
class ActionListPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|||||||
-1
@@ -82,7 +82,6 @@ import org.junit.Test
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.io.path.createTempFile
|
import kotlin.io.path.createTempFile
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class AttachmentsPreviewPresenterTest : RobolectricTest() {
|
class AttachmentsPreviewPresenterTest : RobolectricTest() {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|||||||
-1
@@ -127,7 +127,6 @@ import org.junit.Test
|
|||||||
import uniffi.wysiwyg_composer.MentionsState
|
import uniffi.wysiwyg_composer.MentionsState
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class MessageComposerPresenterTest : RobolectricTest() {
|
class MessageComposerPresenterTest : RobolectricTest() {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|||||||
-1
@@ -103,7 +103,6 @@ import java.util.Date
|
|||||||
import kotlin.time.Duration
|
import kotlin.time.Duration
|
||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
|
||||||
class TimelinePresenterTest {
|
class TimelinePresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
|
|||||||
-1
@@ -83,7 +83,6 @@ import org.junit.Test
|
|||||||
import kotlin.time.Duration
|
import kotlin.time.Duration
|
||||||
import kotlin.time.Duration.Companion.minutes
|
import kotlin.time.Duration.Companion.minutes
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class TimelineItemContentMessageFactoryTest : RobolectricTest() {
|
class TimelineItemContentMessageFactoryTest : RobolectricTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `test create OtherMessageType`() = runTest {
|
fun `test create OtherMessageType`() = runTest {
|
||||||
|
|||||||
-1
@@ -30,7 +30,6 @@ import kotlinx.coroutines.test.runTest
|
|||||||
import org.junit.Rule
|
import org.junit.Rule
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class TypingNotificationPresenterTest {
|
class TypingNotificationPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|||||||
-1
@@ -63,7 +63,6 @@ import kotlin.time.Duration
|
|||||||
import kotlin.time.Duration.Companion.milliseconds
|
import kotlin.time.Duration.Companion.milliseconds
|
||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class DefaultVoiceMessageComposerPresenterTest {
|
class DefaultVoiceMessageComposerPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|||||||
-1
@@ -45,7 +45,6 @@ import kotlinx.coroutines.test.runTest
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.time.Duration.Companion.milliseconds
|
import kotlin.time.Duration.Companion.milliseconds
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class NotificationSettingsPresenterTest {
|
class NotificationSettingsPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - ensures initial state is correct`() = runTest {
|
fun `present - ensures initial state is correct`() = runTest {
|
||||||
|
|||||||
-1
@@ -68,7 +68,6 @@ import org.junit.Rule
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.time.Duration.Companion.milliseconds
|
import kotlin.time.Duration.Companion.milliseconds
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
class RoomDetailsPresenterTest {
|
class RoomDetailsPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
|
|||||||
-1
@@ -50,7 +50,6 @@ import org.junit.Rule
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
class RoomDetailsEditPresenterTest {
|
class RoomDetailsEditPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
|
|||||||
-1
@@ -43,7 +43,6 @@ import kotlinx.collections.immutable.persistentListOf
|
|||||||
import kotlinx.coroutines.test.runTest
|
import kotlinx.coroutines.test.runTest
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class SecurityAndPrivacyPresenterTest {
|
class SecurityAndPrivacyPresenterTest {
|
||||||
@Test
|
@Test
|
||||||
fun `present - initial states`() = runTest {
|
fun `present - initial states`() = runTest {
|
||||||
|
|||||||
-1
@@ -57,7 +57,6 @@ import org.junit.Test
|
|||||||
import org.robolectric.RuntimeEnvironment
|
import org.robolectric.RuntimeEnvironment
|
||||||
import org.robolectric.annotation.Config
|
import org.robolectric.annotation.Config
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class DefaultPinnedMessagesBannerFormatterTest : RobolectricTest() {
|
class DefaultPinnedMessagesBannerFormatterTest : RobolectricTest() {
|
||||||
private lateinit var context: Context
|
private lateinit var context: Context
|
||||||
private lateinit var fakeMatrixClient: FakeMatrixClient
|
private lateinit var fakeMatrixClient: FakeMatrixClient
|
||||||
|
|||||||
-1
@@ -58,7 +58,6 @@ import org.junit.Test
|
|||||||
import org.robolectric.RuntimeEnvironment
|
import org.robolectric.RuntimeEnvironment
|
||||||
import org.robolectric.annotation.Config
|
import org.robolectric.annotation.Config
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class DefaultRoomLatestEventFormatterTest : RobolectricTest() {
|
class DefaultRoomLatestEventFormatterTest : RobolectricTest() {
|
||||||
private lateinit var context: Context
|
private lateinit var context: Context
|
||||||
private lateinit var fakeMatrixClient: FakeMatrixClient
|
private lateinit var fakeMatrixClient: FakeMatrixClient
|
||||||
|
|||||||
-1
@@ -21,7 +21,6 @@ import org.junit.Test
|
|||||||
import org.robolectric.RuntimeEnvironment
|
import org.robolectric.RuntimeEnvironment
|
||||||
import org.robolectric.annotation.Config
|
import org.robolectric.annotation.Config
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class RtcNotificationContentFormatterTest : RobolectricTest() {
|
class RtcNotificationContentFormatterTest : RobolectricTest() {
|
||||||
private lateinit var context: Context
|
private lateinit var context: Context
|
||||||
private lateinit var fakeMatrixClient: FakeMatrixClient
|
private lateinit var fakeMatrixClient: FakeMatrixClient
|
||||||
|
|||||||
-1
@@ -54,7 +54,6 @@ import kotlinx.coroutines.test.runTest
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.time.Duration.Companion.minutes
|
import kotlin.time.Duration.Companion.minutes
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class InReplyToMetadataKtTest : RobolectricTest() {
|
class InReplyToMetadataKtTest : RobolectricTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `any message content`() = runTest {
|
fun `any message content`() = runTest {
|
||||||
|
|||||||
-1
@@ -62,7 +62,6 @@ import kotlinx.collections.immutable.toImmutableList
|
|||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import kotlin.time.Duration.Companion.seconds
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class EventItemFactoryTest {
|
class EventItemFactoryTest {
|
||||||
@Test
|
@Test
|
||||||
fun `create check all null cases`() {
|
fun `create check all null cases`() {
|
||||||
|
|||||||
-1
@@ -64,7 +64,6 @@ private val TESTED_MEDIA_INFO = anApkMediaInfo(
|
|||||||
senderId = A_USER_ID,
|
senderId = A_USER_ID,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class MediaViewerPresenterTest {
|
class MediaViewerPresenterTest {
|
||||||
@get:Rule
|
@get:Rule
|
||||||
val warmUpRule = WarmUpRule()
|
val warmUpRule = WarmUpRule()
|
||||||
|
|||||||
-1
@@ -69,7 +69,6 @@ import org.junit.Test
|
|||||||
import org.robolectric.RuntimeEnvironment
|
import org.robolectric.RuntimeEnvironment
|
||||||
import org.robolectric.annotation.Config
|
import org.robolectric.annotation.Config
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class DefaultNotifiableEventResolverTest : RobolectricTest() {
|
class DefaultNotifiableEventResolverTest : RobolectricTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `resolve event no session`() = runTest {
|
fun `resolve event no session`() = runTest {
|
||||||
|
|||||||
-1
@@ -52,7 +52,6 @@ import kotlin.time.Duration.Companion.milliseconds
|
|||||||
|
|
||||||
private const val A_PUSHER_INFO = "info"
|
private const val A_PUSHER_INFO = "info"
|
||||||
|
|
||||||
@Suppress("LargeClass")
|
|
||||||
class DefaultPushHandlerTest {
|
class DefaultPushHandlerTest {
|
||||||
@Test
|
@Test
|
||||||
fun `check handleInvalid behavior`() = runTest {
|
fun `check handleInvalid behavior`() = runTest {
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ complexity:
|
|||||||
active: true
|
active: true
|
||||||
LargeClass:
|
LargeClass:
|
||||||
active: true
|
active: true
|
||||||
|
# Do not report large test classes.
|
||||||
|
excludes: [ '**/test/**', '**/androidTest/**' ]
|
||||||
|
|
||||||
naming:
|
naming:
|
||||||
VariableNaming:
|
VariableNaming:
|
||||||
|
|||||||
Reference in New Issue
Block a user