Find Android lifecycle / LiveData smells

Proprietary

Lifecycle and observable-state patterns that leak across configuration changes or expose internal mutability: LiveData.observe(this, ...) inside fragments, MutableLiveData.postValue from main-thread contexts, public MutableLiveData properties, and raw MutableLiveData allocations.

org.openrewrite.kotlin.android.FindAndroidLifecycleSmells$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.android.FindAndroidLifecycleSmells$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Find LiveData.observe(this, observer) calls inside Fragment
  2. Find MutableLiveData.postValue(...) calls inside coroutine main-thread contexts
  3. Find public MutableLiveData properties
  4. Find MutableLiveData allocations