mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 08:15:02 +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 kotlin.time.Duration.Companion.seconds
|
||||
|
||||
@Suppress("LargeClass")
|
||||
class RoomListPresenterTest {
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
-1
@@ -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()
|
||||
|
||||
-1
@@ -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()
|
||||
|
||||
-1
@@ -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()
|
||||
|
||||
-1
@@ -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 {
|
||||
|
||||
-1
@@ -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()
|
||||
|
||||
-1
@@ -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()
|
||||
|
||||
-1
@@ -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()
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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 {
|
||||
|
||||
-1
@@ -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()
|
||||
|
||||
-1
@@ -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()
|
||||
|
||||
-1
@@ -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 {
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -50,7 +50,6 @@ import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import java.io.File
|
||||
|
||||
@Suppress("LargeClass")
|
||||
@ExperimentalCoroutinesApi
|
||||
class RoomDetailsEditPresenterTest {
|
||||
@get:Rule
|
||||
|
||||
-1
@@ -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 {
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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
|
||||
|
||||
-1
@@ -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 {
|
||||
|
||||
-1
@@ -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`() {
|
||||
|
||||
-1
@@ -64,7 +64,6 @@ private val TESTED_MEDIA_INFO = anApkMediaInfo(
|
||||
senderId = A_USER_ID,
|
||||
)
|
||||
|
||||
@Suppress("LargeClass")
|
||||
class MediaViewerPresenterTest {
|
||||
@get:Rule
|
||||
val warmUpRule = WarmUpRule()
|
||||
|
||||
-1
@@ -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 {
|
||||
|
||||
-1
@@ -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 {
|
||||
|
||||
@@ -175,6 +175,8 @@ complexity:
|
||||
active: true
|
||||
LargeClass:
|
||||
active: true
|
||||
# Do not report large test classes.
|
||||
excludes: [ '**/test/**', '**/androidTest/**' ]
|
||||
|
||||
naming:
|
||||
VariableNaming:
|
||||
|
||||
Reference in New Issue
Block a user