- Formatting rule set was removed. Use the
detektIdeaFormattask, KtLint or wait for the official kotlin format tool which will be released soon (Hadi mentioned it in a reply to a tweet somewhere). - McCabe calculation was corrected and can now be slightly higher which can result in unexpected
ComplexMethodfindings.
- CatchXXX and ThrowXXX rules were reimplemented and combined into TooGenericExceptionCatched and TooGenericExceptionThrown rules. Own exceptions can be added to the list.
- EmptyXXXBlock rules were reimplemented and can be turned off individually
- The rule NamingConventions was reimplemented and now every case is separately configurable and new cases were added
- MagicNumber rule has now different ignore properties
- Make sure to upgrade! RC2 fixes a number of MagicNumber's issues and adds properties to make this rule more configurable.
- Attention: new
MagicNumberandReturnCountrules can let your CI fail - Sample project now reflects all possible custom extensions to detekt, see
extensionssection in README --outputpoints to a directory now. This is due the fact that many output reports can be generated at once- Each
OutputReportspecifies a file name and ending. The parameter--output-namecan be used to override the default provided file name of theOutputReport. Unnecessary output reports for your project can be turned off in the configuration.
- Misspelled class
Deptwas renamed toDebt, if you using custom rule sets, please rebuild it - CLI parameter
--projectwas renamed to--inputto match the input parameter of the gradle plugin
- No break just extra notification that you can pass now more than one configuration file within the
--configand--config-resourceparameters
This allows overriding certain configuration parameters in the base configuration (left-most config)
- the detekt extension is now aware of
configuration profiles - non default or 'main' profile, needs to be specified like
gradle detektCheck -Ddetekt.profile=[profile-name]
Instead of writing something like
detekt {
version = "1.0.0.M11"
input = "$project.projectDir/src"
filters = '.*/test/.*'
config = "$project.projectDir/detekt-config.yml"
output = "$project.projectDir/output.xml"
idea {
path = "$USER_HOME/.idea"
codeStyleScheme = "$USER_HOME/.idea/idea-code-style.xml"
inspectionsProfile = "$USER_HOME/.idea/inspect.xml"
mask = "*.kt,"
}
}you have to put a profile-closure around the parameters
detekt {
profile("main") {
version = "1.0.0.M11"
input = "$project.projectDir/src"
filters = '.*/test/.*'
config = "$project.projectDir/detekt-config.yml"
output = "$project.projectDir/output.xml"
}
profile("test") {
filters = ".*/src/main/kotlin/.*"
config = "$project.projectDir/detekt-test-config.yml"
}
idea {
path = "$USER_HOME/.idea"
codeStyleScheme = "$USER_HOME/.idea/idea-code-style.xml"
inspectionsProfile = "$USER_HOME/.idea/inspect.xml"
mask = "*.kt,"
}
}This allows you too configure detekt-rules specific for each module. Also allowing to have different configurations for production or test code.
NoDocOverPublicClass->UndocumentedPublicClassNoDocOverPublicMethod->UndocumentedPublicFunction
Rename this id's in your configuration
detekttask was renamed todetektCheck(gradle-plugin)
empty->empty-blocks
code-smellrule set was renamed tocomplexityrule set (config)