Skip to content

Commit

Permalink
Fix aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed May 20, 2024
1 parent 344d5be commit 18a7c73
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 14 deletions.
9 changes: 4 additions & 5 deletions detekt-core/src/main/resources/default-detekt-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ complexity:
ignoreOverloaded: false
CyclomaticComplexMethod:
active: true
aliases: ['ComplexMethod']
allowedComplexity: 14
ignoreSingleWhenExpression: false
ignoreSimpleWhenEntries: false
Expand Down Expand Up @@ -378,7 +377,7 @@ naming:
privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
PackageNaming:
active: true
aliases: ['PackageName', 'PackageDirectoryMismatch']
aliases: ['PackageName']
packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*'
TopLevelPropertyNaming:
active: true
Expand Down Expand Up @@ -777,18 +776,18 @@ style:
active: false
UnusedParameter:
active: true
aliases: ['UNUSED_VARIABLE', 'UNUSED_PARAMETER', 'unused', 'UnusedPrivateMember']
aliases: ['UNUSED_PARAMETER', 'unused']
allowedNames: 'ignored|expected'
UnusedPrivateClass:
active: true
aliases: ['unused']
UnusedPrivateMember:
active: true
aliases: ['UNUSED_VARIABLE', 'UNUSED_PARAMETER', 'unused']
aliases: ['unused']
allowedNames: ''
UnusedPrivateProperty:
active: true
aliases: ['UNUSED_PARAMETER', 'unused', 'UnusedPrivateMember']
aliases: ['unused']
allowedNames: 'ignored|expected|serialVersionUID'
UnusedVariable:
active: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package io.gitlab.arturbosch.detekt.rules.complexity

import io.github.detekt.metrics.CyclomaticComplexity
import io.gitlab.arturbosch.detekt.api.ActiveByDefault
import io.gitlab.arturbosch.detekt.api.Alias
import io.gitlab.arturbosch.detekt.api.Config
import io.gitlab.arturbosch.detekt.api.Configuration
import io.gitlab.arturbosch.detekt.api.Entity
Expand Down Expand Up @@ -34,7 +33,6 @@ import org.jetbrains.kotlin.psi.KtWhenExpression
* [Reference](https://kotlinlang.org/docs/scope-functions.html)
*/
@ActiveByDefault(since = "1.0.0")
@Alias("ComplexMethod")
class CyclomaticComplexMethod(config: Config) : Rule(
config,
"Prefer splitting up complex methods into smaller, easier to test methods."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.psi.KtPackageDirective
* Reports package names that do not follow the specified naming convention.
*/
@ActiveByDefault(since = "1.0.0")
@Alias("PackageName", "PackageDirectoryMismatch")
@Alias("PackageName")
class PackageNaming(config: Config) : Rule(
config,
"Package names should match the naming convention set in the configuration."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import org.jetbrains.kotlin.psi.psiUtil.isProtected
* </compliant>
*/
@ActiveByDefault(since = "1.23.0")
@Alias("UNUSED_VARIABLE", "UNUSED_PARAMETER", "unused", "UnusedPrivateMember")
@Alias("UNUSED_PARAMETER", "unused")
class UnusedParameter(config: Config) : Rule(
config,
"Function parameter is unused and should be removed."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private const val ARRAY_GET_METHOD_NAME = "get"
*/
@RequiresTypeResolution
@ActiveByDefault(since = "1.16.0")
@Alias("UNUSED_VARIABLE", "UNUSED_PARAMETER", "unused")
@Alias("unused")
class UnusedPrivateMember(config: Config) : Rule(
config,
"Private function is unused and should be removed."
Expand All @@ -73,7 +73,7 @@ private class UnusedFunctionVisitor(
private val invokeOperatorReferences = mutableMapOf<CallableDescriptor, MutableList<KtReferenceExpression>>()
private val propertyDelegates = mutableListOf<KtPropertyDelegate>()

@Suppress("ComplexMethod", "LongMethod")
@Suppress("CyclomaticComplexMethod", "LongMethod")
fun getUnusedReports(): List<CodeSmell> {
val propertyDelegateResultingDescriptors by lazy(LazyThreadSafetyMode.NONE) {
propertyDelegates.flatMap { it.resultingDescriptors() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import org.jetbrains.kotlin.resolve.bindingContextUtil.getReferenceTargets
*/
@RequiresTypeResolution
@ActiveByDefault(since = "1.23.0")
@Alias("UNUSED_PARAMETER", "unused", "UnusedPrivateMember")
@Alias("unused")
class UnusedPrivateProperty(config: Config) : Rule(
config,
"Property is unused and should be removed."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameOrNull
*
*/
@RequiresTypeResolution
@Suppress("ComplexMethod")
class UseIfEmptyOrIfBlank(config: Config) : Rule(
config,
"Use `ifEmpty` or `ifBlank` instead of `isEmpty` or `isBlank` to assign a default value."
) {

@Suppress("ReturnCount")
@Suppress("ReturnCount", "CyclomaticComplexMethod")
override fun visitIfExpression(expression: KtIfExpression) {
super.visitIfExpression(expression)

Expand Down

0 comments on commit 18a7c73

Please sign in to comment.