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
@@ -57,7 +57,6 @@ import org.junit.Test
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
@Suppress("LargeClass")
class DefaultPinnedMessagesBannerFormatterTest : RobolectricTest() {
private lateinit var context: Context
private lateinit var fakeMatrixClient: FakeMatrixClient
@@ -58,7 +58,6 @@ import org.junit.Test
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
@Suppress("LargeClass")
class DefaultRoomLatestEventFormatterTest : RobolectricTest() {
private lateinit var context: Context
private lateinit var fakeMatrixClient: FakeMatrixClient
@@ -21,7 +21,6 @@ import org.junit.Test
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
@Suppress("LargeClass")
class RtcNotificationContentFormatterTest : RobolectricTest() {
private lateinit var context: Context
private lateinit var fakeMatrixClient: FakeMatrixClient
@@ -54,7 +54,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.Test
import kotlin.time.Duration.Companion.minutes
@Suppress("LargeClass")
class InReplyToMetadataKtTest : RobolectricTest() {
@Test
fun `any message content`() = runTest {
@@ -62,7 +62,6 @@ import kotlinx.collections.immutable.toImmutableList
import org.junit.Test
import kotlin.time.Duration.Companion.seconds
@Suppress("LargeClass")
class EventItemFactoryTest {
@Test
fun `create check all null cases`() {
@@ -64,7 +64,6 @@ private val TESTED_MEDIA_INFO = anApkMediaInfo(
senderId = A_USER_ID,
)
@Suppress("LargeClass")
class MediaViewerPresenterTest {
@get:Rule
val warmUpRule = WarmUpRule()
@@ -69,7 +69,6 @@ import org.junit.Test
import org.robolectric.RuntimeEnvironment
import org.robolectric.annotation.Config
@Suppress("LargeClass")
class DefaultNotifiableEventResolverTest : RobolectricTest() {
@Test
fun `resolve event no session`() = runTest {
@@ -52,7 +52,6 @@ import kotlin.time.Duration.Companion.milliseconds
private const val A_PUSHER_INFO = "info"
@Suppress("LargeClass")
class DefaultPushHandlerTest {
@Test
fun `check handleInvalid behavior`() = runTest {