Skip to content

Commit

Permalink
Add konsist check for vm function return type
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-mullvad committed Sep 29, 2023
1 parent 5264e13 commit 37150c4
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package net.mullvad.mullvadvpn.test.arch

import androidx.lifecycle.ViewModel
import com.lemonappdev.konsist.api.Konsist
import com.lemonappdev.konsist.api.ext.list.functions
import com.lemonappdev.konsist.api.ext.list.modifierprovider.withPublicOrDefaultModifier
import com.lemonappdev.konsist.api.ext.list.properties
import com.lemonappdev.konsist.api.ext.list.withAllParentsOf
Expand All @@ -23,6 +24,13 @@ class ViewModelTests {
}
}

@Test
fun ensurePublicFunctionsHaveNoReturnType() {
allViewModels().functions().withPublicOrDefaultModifier().assert { function ->
function.hasReturnType.not()
}
}

private fun allViewModels() =
Konsist.scopeFromProject().classes().withAllParentsOf(ViewModel::class)

Expand Down

0 comments on commit 37150c4

Please sign in to comment.