This repository contains an opinionated set of Detekt Rules for Android projects
detekt {
    // ...
}
dependencies {
    detektPlugins "br.com.wesjon:detekt-android-rules:0.1" // Add it here
    detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$detekt_version"
}You may want to activate or deactivate rules according to your project needs.
android-rules:
  TestNameShouldFollowNamingConvention:
    active: true
    namingConvention: 'backtick' // REQUIRED: backtick, snake_case or camelCase
  ViewModelExposesState:
    active: true
    customViewModel: 'BaseViewModel,CustomViewModel' // OPTIONAL: If your application uses base/custom ViewModelsChecks whether test names follow the name convention. This rule only applies if method is annotated with @Test
CONFIG: backtick
@Test
fun additionIsCorrect(){
    // ...
}// config: backtick
@Test
fun `addition is correct`(){
    // ...
}
// config: snake_case
@Test
fun addition_is_correct(){
    // ...
}
// config: camelCase
@Test
fun additionIsCorrect(){
    // ...
}MVVM has popularized the use of ViewModels in Android apps. Exposing a MutableLiveData to the View layer is an antipattern and should be avoided when using ViewModels.
class LoginViewModel: ViewModel() {
     val loginViewState = MutableLiveData<LoginViewState>()
}class LoginViewModel: ViewModel() {
     private val loginViewState = MutableLiveData<LoginViewState>()
     val loginViewState: LiveData<LoginViewState> = _loginViewState
}