Skip to content

suppress Detekt's ComplexMethod for single when statements #584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2022
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
4 changes: 2 additions & 2 deletions detekt/detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ complexity:
ComplexMethod:
active: true
threshold: 15
ignoreSingleWhenExpression: false
ignoreSimpleWhenEntries: false
ignoreSingleWhenExpression: true
ignoreSimpleWhenEntries: true
ignoreNestingFunctions: false
nestingFunctions:
- 'also'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ abstract class DependenciesBlock(
companion object {
val testFixturesRegex = "testFixtures\\([\\s\\S]*\\)".toRegex()

@Suppress("ComplexMethod", "DeprecatedCallableAddReplaceWith")
@Deprecated("This will be removed soon.")
private fun migrateLegacyIdOrNull(legacyID: String, logger: Logger): String? {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ suspend fun <T> T.createProjectDependencyDeclaration(
) { it.value }
}

@Suppress("ComplexMethod")
private tailrec fun <T> SourceSetName.isDefinitelyPrecompiledForProject(project: T): Boolean
where T : PluginAware,
T : HasDependencyDeclarations {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal data class ParsedFile(
val enumDeclarations: Set<DeclaredName>
) {
companion object {
@Suppress("ComplexMethod")

fun fromCompilationUnitLazy(compilationUnit: CompilationUnit): Lazy<ParsedFile> {
return lazy {
val packageFqName = compilationUnit.packageDeclaration.getOrNull()?.nameAsString ?: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,6 @@ fun <T> T.canBeImported(): Boolean
return isStatic() && !isPrivate() && this is Resolvable<*>
}

@Suppress("ComplexMethod")
internal fun JavaVersion.toLanguageLevel(): LanguageLevel {
return when (this) {
VERSION_1_1 -> LanguageLevel.JAVA_1_1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ sealed class UnqualifiedAndroidResourceDeclaredName(
"style"
)

@Suppress("ComplexMethod")
fun fromFile(file: File): UnqualifiedAndroidResourceDeclaredName? {
val dir = file.toPath().parent?.name ?: return null
val name = file.nameWithoutExtension
Expand All @@ -208,7 +207,6 @@ sealed class UnqualifiedAndroidResourceDeclaredName(
}
}

@Suppress("ComplexMethod")
fun fromValuePair(type: String, name: String): UnqualifiedAndroidResourceDeclaredName? {
val fixedName = name.replace('.', '_')
return when (type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ interface NamedSymbolTest : FancyShould {
fun unqualifiedAndroidResource(name: String) = UnqualifiedAndroidResourceReference(name)
}

@Suppress("ComplexMethod")
fun Collection<NamedSymbol>.prettyPrint() = groupBy { it::class }
.toList()
.sortedBy { it.first.qualifiedName }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import org.gradle.api.JavaVersion.VERSION_HIGHER

typealias GradleJavaVersion = org.gradle.api.JavaVersion

@Suppress("UnstableApiUsage", "ComplexMethod")
@Suppress("UnstableApiUsage")
fun GradleJavaVersion.toJavaVersion(): JavaVersion {
return when (this) {
VERSION_1_1 -> JavaVersion.VERSION_1_1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import kotlin.properties.Delegates

private typealias ProjectPath = String

@Suppress("LocalVariableName", "VariableNaming", "ComplexMethod")
@Suppress("LocalVariableName", "VariableNaming")
internal fun String.parseReportOutput(): List<Pair<ProjectPath, List<ProjectFindingReport>>> {

val DELIM = "\u200B"
Expand Down