Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions app/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ complexity:
active: false
threshold: 10
includeStaticDeclarations: false
ComplexMethod:
CyclomaticComplexMethod:
active: true
threshold: 10
threshold: 15
ignoreSingleWhenExpression: false
ignoreSimpleWhenEntries: false
excludes: ['**/androidTest/**']
Expand All @@ -70,7 +70,7 @@ complexity:
threshold: 60
excludes: ['**/androidTest/**']
LongParameterList:
active: true
active: false
functionThreshold: 7
constructorThreshold: 6
ignoreDefaultParameters: false
Expand All @@ -87,7 +87,7 @@ complexity:
excludeStringsWithLessThan5Characters: true
ignoreStringsRegex: '$^'
TooManyFunctions:
active: true
active: false
thresholdInFiles: 15
thresholdInClasses: 15
thresholdInInterfaces: 15
Expand Down Expand Up @@ -158,7 +158,7 @@ exceptions:
ThrowingNewInstanceOfSameException:
active: false
TooGenericExceptionCaught:
active: true
active: false
exceptionNames:
- ArrayIndexOutOfBoundsException
- Error
Expand All @@ -170,7 +170,7 @@ exceptions:
- Throwable
allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
TooGenericExceptionThrown:
active: true
active: false
exceptionNames:
- Error
- Exception
Expand Down Expand Up @@ -226,7 +226,7 @@ naming:
active: true
packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$'
TopLevelPropertyNaming:
active: true
active: false
constantPattern: '[A-Z][_A-Z0-9]*'
propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
privatePropertyPattern: '(_)?[A-Za-z][A-Za-z0-9]*'
Expand Down Expand Up @@ -346,7 +346,7 @@ style:
NestedClassesVisibility:
active: false
NewLineAtEndOfFile:
active: true
active: false
NoTabs:
active: false
OptionalAbstractKeyword:
Expand All @@ -362,7 +362,7 @@ style:
RedundantVisibilityModifierRule:
active: false
ReturnCount:
active: true
active: false
max: 2
excludedFunctions: [equals]
excludeLabeled: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import java.util.TreeMap
*
* The implementation is not thread-safe.
*/
@Suppress("TooManyFunctions")
class MockSharedPreferences : SharedPreferences {

class MockEditor(val store: MutableMap<String?, Any?>) : SharedPreferences.Editor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import junit.framework.TestCase.assertFalse
import junit.framework.TestCase.assertTrue
import org.junit.Test

@Suppress("TooManyFunctions")
class StringExtensionTests {
@Test
fun testIsNotBlankAndEqualsWhenGivenBothStringsAreNull() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import org.junit.Test
import java.io.File
import kotlin.random.Random

@Suppress("TooManyFunctions", "MagicNumber")
@Suppress("MagicNumber")
class FileDeletionTests : AbstractIT() {

private val createdFilePaths = mutableListOf<String>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ fun withSelectedText(expected: String): Matcher<View> = object : TypeSafeMatcher
description.appendText("with selected text \"$expected\"")
}

@Suppress("ReturnCount")
override fun matchesSafely(view: View): Boolean {
if (view !is TextView) return false
val text = view.text?.toString() ?: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ class RetryTestRule(val retryCount: Int = defaultRetryValue) : TestRule {

override fun apply(base: Statement, description: Description): Statement = statement(base, description)

@Suppress("TooGenericExceptionCaught") // and this exactly what we want here
private fun statement(base: Statement, description: Description): Statement {
return object : Statement() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import com.owncloud.android.lib.resources.status.OCCapability
import org.junit.Before
import org.junit.Test

@Suppress("TooManyFunctions")
@SinceServer(majorVersion = 30)
class AutoRenameTests : AbstractOnServerIT() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import junit.framework.TestCase.assertFalse
import junit.framework.TestCase.assertTrue
import org.junit.Test

@Suppress("TooManyFunctions")
class FileExtensionTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import org.junit.Test
import java.io.File
import java.nio.file.Files

@Suppress("TooManyFunctions")
class FileHelperTest {

private lateinit var testDirectory: File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.Test

@Suppress("TooManyFunctions")
class FileNameValidatorTests : AbstractOnServerIT() {
companion object {
private const val MAX_FILENAME_SIZE = 250
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import junit.framework.TestCase.assertEquals
import junit.framework.TestCase.assertTrue
import org.junit.Test

@Suppress("MagicNumber", "TooManyFunctions")
@Suppress("MagicNumber")
class OCCapabilityJsonToListTests : AbstractIT() {
private var capability: OCCapability = fileDataStorageManager.getCapability(account.name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import junit.framework.TestCase.assertFalse
import junit.framework.TestCase.assertTrue
import org.junit.Test

@Suppress("TooManyFunctions")
class SharePermissionManagerTest {

private fun createShare(sharePermission: Int, isFolder: Boolean = false, attributesJson: String? = null): OCShare =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.nextcloud.utils.extensions.webDavParentPath
import org.junit.Assert.assertEquals
import org.junit.Test

@Suppress("TooManyFunctions")
class WebDavParentPathTests {

@Test
Expand Down
2 changes: 1 addition & 1 deletion app/src/androidTest/java/com/owncloud/android/UploadIT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import java.nio.file.attribute.BasicFileAttributes
import java.util.concurrent.TimeUnit
import kotlin.math.abs

@Suppress("TooManyFunctions", "DEPRECATION")
@Suppress("DEPRECATION")
class UploadIT : AbstractOnServerIT() {
private val uploadsStorageManager = UploadsStorageManager(
UserAccountManagerImpl.fromContext(targetContext),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class AuthenticatorActivityIT {
}

@Test
@Suppress("TooGenericExceptionCaught")
fun tryCatch() {
val color = try {
Color.parseColor("1")
Expand All @@ -30,7 +29,6 @@ class AuthenticatorActivityIT {
}

@Test
@Suppress("TooGenericExceptionCaught")
fun tryCatch2() {
val color = try {
Color.parseColor("")
Expand All @@ -42,7 +40,6 @@ class AuthenticatorActivityIT {
}

@Test
@Suppress("TooGenericExceptionCaught")
fun tryCatch3() {
val color = try {
Color.parseColor(null)
Expand All @@ -54,7 +51,6 @@ class AuthenticatorActivityIT {
}

@Test
@Suppress("TooGenericExceptionCaught")
fun tryCatch4() {
val color = try {
Color.parseColor("abc")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File

@Suppress("TooManyFunctions", "DEPRECATION")
@Suppress("DEPRECATION")
class InternalTwoWaySyncIT : AbstractInternalTwoWaySyncIT() {

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class LoginIT : AbstractIT() {
*/
@Test
@Throws(InterruptedException::class)
@Suppress("MagicNumber", "SwallowedException")
@Suppress("MagicNumber")
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.Q)
@Flaky("Login no longer uses an in-app WebView, so espresso-web (Espresso.onWebView) cannot drive it. ")
fun login() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import javax.inject.Provider
import org.junit.Before
import org.junit.Test

@Suppress("TooManyFunctions")
class UnifiedSearchListAdapterIT : AbstractIT() {

private val testClassName = "com.owncloud.android.ui.adapter.UnifiedSearchListAdapterIT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ import org.junit.Test
import java.net.URI
import java.util.function.Supplier

@Suppress("TooManyFunctions")
class DialogFragmentIT : AbstractIT() {
private val testClassName = "com.owncloud.android.ui.dialog.DialogFragmentIT"
private val serverUrl = "https://nextcloud.localhost"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import org.junit.Before
import org.junit.Rule
import org.junit.Test

@Suppress("TooManyFunctions")
class FileDetailSharingFragmentIT : AbstractIT() {
private val testClassName = "com.owncloud.android.ui.fragment.FileDetailSharingFragmentIT"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ class GalleryFragmentIT : AbstractIT() {
}

/** Recursively walk view tree to find the first RecyclerView. Runs on the same thread that calls it. */
@Suppress("ReturnCount")
private fun findRecyclerViewRecursively(root: View?): RecyclerView? {
if (root == null) return null
if (root is RecyclerView) return root
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ class NotificationsFragmentIT : AbstractIT() {
add(buildNotificationManyActions())
}

@Suppress("ReturnCount")
private fun findFragment(sut: NavigatorActivity): NotificationsFragment? {
val allFragments = sut.supportFragmentManager.fragments
for (f in allFragments) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class TrashbinFragmentIT : AbstractIT() {
FILES
}

@Suppress("ReturnCount")
private fun findFragment(sut: NavigatorActivity): TrashbinFragment? {
val allFragments = sut.supportFragmentManager.fragments
for (f in allFragments) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import org.junit.Assert.assertFalse
import org.junit.Assert.assertNotEquals
import org.junit.Test

@Suppress("TooManyFunctions", "LargeClass")
@Suppress("LargeClass")
class EncryptionUtilsV2IT : EncryptionIT() {
private val encryptionTestUtils = EncryptionTestUtils()
private val encryptionUtilsV2 = EncryptionUtilsV2()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import org.junit.Assert.assertNull
import org.junit.Before
import org.junit.Test

@Suppress("TooManyFunctions")
class FileUploadHelperTest {

private lateinit var uploadDao: UploadDao
Expand All @@ -49,7 +48,6 @@ class FileUploadHelperTest {
fileUploadHelper.fileStorageManager = mockFileStorageManager
}

@Suppress("LongParameterList")
private fun buildEntity(
id: Int = 1,
localPath: String = this.localPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import kotlinx.coroutines.withContext
private const val CHAT_INPUT_DELAY = 100L
private const val PULL_TO_REFRESH_DELAY = 1500L

@Suppress("LongMethod")
@Suppress("LongMethod", "CyclomaticComplexMethod")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun AssistantScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import kotlinx.coroutines.flow.update
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch

@Suppress("TooManyFunctions")
class AssistantViewModel(
private val accountName: String,
private val remoteRepository: AssistantRemoteRepository,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

@file:Suppress("TopLevelPropertyNaming", "MagicNumber")
@file:Suppress("MagicNumber")

package com.nextcloud.client.assistant.chat

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

@file:Suppress("TopLevelPropertyNaming", "MagicNumber")
@file:Suppress("MagicNumber")

package com.nextcloud.client.assistant.conversation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fun TranslationScreen(viewModel: TranslationViewModel, assistantViewModel: Assis
}
}

@Suppress("LongMethod", "LongParameterList")
@Suppress("LongMethod")
@Composable
private fun TranslationSection(
labelId: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.owncloud.android.R
import com.owncloud.android.lib.resources.assistant.v2.model.TaskTypeData
import com.owncloud.android.lib.resources.assistant.v2.model.toTranslationLanguages

@Suppress("LongParameterList")
sealed class TranslationScreenState(
open val taskTypeData: TaskTypeData,
open val source: TranslationSideState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class TranslationViewModel(private val remoteRepository: AssistantRemoteReposito
}
}

@Suppress("ReturnCount")
private suspend fun pollTranslationResult() {
val screenStateValue = _screenState.value
if (screenStateValue is Uninitialized) {
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/nextcloud/client/core/Task.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import java.util.concurrent.atomic.AtomicBoolean
* This is a wrapper for a task function running in background.
* It executes task function and handles result or error delivery.
*/
@Suppress("LongParameterList")
internal class Task<T, P>(
private val postResult: (Runnable) -> Boolean,
private val removeFromQueue: (Runnable) -> Boolean,
Expand All @@ -32,7 +31,6 @@ internal class Task<T, P>(
postResult(Runnable { onProgress?.invoke(p) })
}

@Suppress("TooGenericExceptionCaught") // this is exactly what we want here
override fun run() {
try {
val result = taskBody.invoke({ postProgress(it) }, this::isCancelled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ import com.owncloud.android.db.ProviderMeta
],
exportSchema = true
)
@Suppress("Detekt.UnnecessaryAbstractClass") // needed by Room
@TypeConverters(OfflineOperationTypeConverter::class)
abstract class NextcloudDatabase : RoomDatabase() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import com.nextcloud.client.database.entity.FileEntity
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta
import com.owncloud.android.utils.MimeType

@Suppress("TooManyFunctions")
@Dao
interface FileDao {
@Update
Expand Down
Loading
Loading