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:
Benoit Marty
2026-09-15 13:56:33 +02:00
committed by GitHub
parent a4286a932a
commit 3e861cc646
25 changed files with 2 additions and 24 deletions
@@ -91,7 +91,6 @@ import org.junit.Rule
import org.junit.Test
import kotlin.time.Duration.Companion.seconds
@Suppress("LargeClass")
class RoomListPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -59,7 +59,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test
@Suppress("LargeClass")
internal class DefaultInvitePeoplePresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -70,7 +70,6 @@ import org.junit.Rule
import org.junit.Test
import java.util.Optional
@Suppress("LargeClass")
class JoinRoomPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -125,7 +125,6 @@ import org.junit.Test
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
@Suppress("LargeClass")
class MessagesPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -90,7 +90,6 @@ import org.junit.Test
import org.robolectric.annotation.Config
import kotlin.time.Duration.Companion.milliseconds
@Suppress("LargeClass")
class MessagesViewTest : RobolectricTest() {
@Test
fun `clicking on back invoke expected callback`() = runAndroidComposeUiTest {
@@ -54,7 +54,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test
@Suppress("LargeClass")
class ActionListPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -82,7 +82,6 @@ import org.junit.Test
import java.io.File
import kotlin.io.path.createTempFile
@Suppress("LargeClass")
class AttachmentsPreviewPresenterTest : RobolectricTest() {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -127,7 +127,6 @@ import org.junit.Test
import uniffi.wysiwyg_composer.MentionsState
import java.io.File
@Suppress("LargeClass")
class MessageComposerPresenterTest : RobolectricTest() {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -103,7 +103,6 @@ import java.util.Date
import kotlin.time.Duration
import kotlin.time.Duration.Companion.seconds
@Suppress("LargeClass")
@OptIn(ExperimentalCoroutinesApi::class, FlowPreview::class)
class TimelinePresenterTest {
@get:Rule
@@ -83,7 +83,6 @@ import org.junit.Test
import kotlin.time.Duration
import kotlin.time.Duration.Companion.minutes
@Suppress("LargeClass")
class TimelineItemContentMessageFactoryTest : RobolectricTest() {
@Test
fun `test create OtherMessageType`() = runTest {
@@ -30,7 +30,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Rule
import org.junit.Test
@Suppress("LargeClass")
class TypingNotificationPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -63,7 +63,6 @@ import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
@Suppress("LargeClass")
class DefaultVoiceMessageComposerPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -45,7 +45,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
import kotlin.time.Duration.Companion.milliseconds
@Suppress("LargeClass")
class NotificationSettingsPresenterTest {
@Test
fun `present - ensures initial state is correct`() = runTest {
@@ -68,7 +68,6 @@ import org.junit.Rule
import org.junit.Test
import kotlin.time.Duration.Companion.milliseconds
@Suppress("LargeClass")
@ExperimentalCoroutinesApi
class RoomDetailsPresenterTest {
@get:Rule
@@ -50,7 +50,6 @@ import org.junit.Rule
import org.junit.Test
import java.io.File
@Suppress("LargeClass")
@ExperimentalCoroutinesApi
class RoomDetailsEditPresenterTest {
@get:Rule
@@ -43,7 +43,6 @@ import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.test.runTest
import org.junit.Test
@Suppress("LargeClass")
class SecurityAndPrivacyPresenterTest {
@Test
fun `present - initial states`() = runTest {