This repository contains custom detekt rules based on Doist internal coding conventions.
First add detekt to your repository. Then follow adding more rule sets instructions and add this detekt plugin in your gradle file:
dependencies {
detektPlugins("com.doist.detekt:detekt-rules:[version]")
}
To release, update the version in the build.gradle.kts
file and run:
git add build.gradle.kts
git commit -m "Release X.Y.Z"
git tag vX.Y.Z
git push --tags
After that GitHub actions will automatically create new release and publish it.
This rule reports every class that has an empty line between a class header and its body.
This rule reports when statements that have some entries single line and some multiline.
This rule reports every when entry expression that is on a separate line and is not wrapped with brackets.
For example this is incorrect:
val a = when {
c == b ->
true
else ->
false
}
Instead it should be:
val a = when {
c == b -> true
else -> false
}
// or
val a = when {
c == b -> {
true
}
else -> {
false
}
}
This rule reports exposed MutableLive...
and MutableStateFlow
properties. They should be
private.
This rule reports !!
usage. requireNotNull
should be used instead.
Reports when TODO comment does not match a pattern. Default pattern is // TODO(.+): .*
.
This rule reports if an override function does not have a new line after the super call.
For example this is incorrect:
override fun foo() {
super.foo()
bar.bazinga()
}
Instead it should be:
override fun foo() {
super.foo()
bar.bazinga()
}