Add OmitFromCoverage annotation to exclude special cases (#318)

This commit is contained in:
Brian Yencho 2023-12-04 18:40:37 -06:00 committed by Álison Fernandes
parent 19df16d049
commit f8fefae3b8
4 changed files with 21 additions and 2 deletions

View file

@ -144,7 +144,9 @@ koverReport {
excludes {
annotatedBy(
// Compose previews
"androidx.compose.ui.tooling.preview.Preview"
"androidx.compose.ui.tooling.preview.Preview",
// Manually excluded classes/files/etc.
"com.x8bit.bitwarden.data.platform.annotation.OmitFromCoverage"
)
classes(
// Navigation helpers

View file

@ -1,10 +1,12 @@
package com.x8bit.bitwarden.data.auth.util
import com.bitwarden.core.Kdf
import com.x8bit.bitwarden.data.platform.annotation.OmitFromCoverage
/**
* Constants relating to [Kdf] initialization defaults.
*/
@OmitFromCoverage
object KdfParamsConstants {
/**

View file

@ -0,0 +1,13 @@
package com.x8bit.bitwarden.data.platform.annotation
/**
* Used to omit the annotated class from test coverage reporting. This should be used sparingly and
* is intended for non-testable classes that are placed in packages along with testable ones.
*/
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.FILE,
AnnotationTarget.FUNCTION,
)
@Retention(AnnotationRetention.BINARY)
annotation class OmitFromCoverage

View file

@ -1,10 +1,12 @@
package com.x8bit.bitwarden.data.platform.util
import android.os.Build
import com.x8bit.bitwarden.data.platform.annotation.OmitFromCoverage
/**
* Provides device model string. Useful for mocking static [Build.model] call tests.
* Provides device model string. Useful for mocking static [Build.MODEL] call tests.
*/
@OmitFromCoverage
class DeviceModelProvider {
/**