currently I have detekt and detekt-formatting `1.2...
# detekt
g
currently I have detekt and detekt-formatting
1.23.1
. Does anyone know if detekt can auto-correct new lines in functions and constructor params? I mean, from this:
Copy code
fun account(val name: String, val id: String, val dateOfBirth: Date) { 
    ...
}
to this:
Copy code
fun account(
    val name: String, 
    val id: String, 
    val dateOfBirth: Date
) { 
    ...
}
s
đź‘Ť since you said you have detekt-formatting, you can use the ParameterListWrapping rule for this
g
it's active but not working when I run detekt?
Copy code
ParameterListWrapping:
    active: true
    autoCorrect: true
    maxLineLength: 140
    indentSize: 4
also my detekt cofing file has autocorrect = true
Copy code
detekt {

    input = files("$projectDir")
    config = files("$rootDir/config/detekt/detekt.yml")

    autoCorrect = true
    parallel = true
    buildUponDefaultConfig = true

    reports {
        html.enabled = true
        xml.enabled = true
        txt.enabled = false
    }

    ignoredBuildTypes = ["release"]

    dependencies {
        detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.23.1"
        detektPlugins "com.twitter.compose.rules:detekt:0.0.26"
    }
}
s
140 seems quite high for the line length. That could be the problem. I think it will only reformat it if the parameter list wouldn’t fit on a single line. I don’t know whether there’s an option to make it always use multiple lines regardless of line length.