Skip to content

LongMethod should not consider parameters while calculating the number of lines #2804

@niraj8

Description

@niraj8

Expected Behavior

LongMethod should consider the method definition without the input parameters.
Example:
If LongMethod threshold is set to 7, then the below method shouldn't be tagged as the method implementation is actually 3 loc and detekt already has LongParameterList to check the param list

fun fetch(
        user: User,
        org: Org,
        @QueryValue startDate: String,
        @QueryValue endDate: String
    ) {
        val data = service1.get(startDate, endDate, context.user, context.org)
        val moreData = service2.get(startDate)
        ok(mapOf("data" to data+moreData))
    }

Observed Behavior

The above snippet of code gets tagged with LongMethod code smell

Steps to Reproduce

#2806

Context

More LongMethod code smell then expected

Your Environment

  • Version of detekt used:1.9.1
  • Version of Gradle used (if applicable):6.1.1
  • Operating System and version:macOS 10.15.5
  • Link to your project (if it's a public repository):

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions