vanniktech/gradle-code-quality-tools-plugin

VariableMinLength not working as intended

amagdaleno opened this issue · 2 comments

Hello again, I opened an issue on the detekt project because I was having trouble with the VariableMinLength setting on detekt. I've been busy this days, but I got back on the project I had the issue on today, and couldn't reproduce either so there's that.

I've however been making some tests on my own and there is something weird going on with this. Now it's possible that I'm a complete idiot and there's something obvious that I'm missing but, I'm getting different results on my project and this test project with copy pasted settings. To illustrate why I think there's something weird going on, the project has variables of length < 10 but is passing gradle check with detekt reporting 0 smells., with this detekt.yml

autoCorrect: false
failFast: true

style:
  VariableMinLength:
    active: true
    minimumVariableNameLength: 10

naming:
  VariableMinLength:
    active: true
    minimumVariableNameLength: 10

I'll have a look at your test project. Thanks for setting it up.

lint {
    abortOnError = true
    warningsAsErrors = false
}

abortOnError is the default and hence you would not need to specify it.

You're using

detekt {
    version = '1.0.0.RC6-4'
}
ktlint {
    version = '0.21.0'
}

whereas it should be toolVersion so:

detekt {
    toolVersion = '1.0.0.RC6-4'
}
ktlint {
    toolVersion = '0.21.0'
}

There's some problem with failFast: true and VariableMinLength. If you use the following configuration everything works:

naming:
  VariableMinLength:
    active: true
    minimumVariableNameLength: 10

where as this one does not:

failFast: true

naming:
  VariableMinLength:
    active: true
    minimumVariableNameLength: 10

This can be reported back to detekt. There's probably something wrong with the failFast and the merge of the default configuration file.