feat(coverage): Update coverage rules and introduce new ExcludeFromCoverage annotation.

.
This commit is contained in:
dkadrikj 2023-08-25 14:35:11 +02:00 committed by Dino Kadrikj
parent 3b1596cb54
commit 0061b0ae37
10 changed files with 43 additions and 2 deletions

View File

@ -24,7 +24,9 @@ import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.components.SingletonComponent
import me.proton.core.util.kotlin.annotation.ExcludeFromCoverage
@ExcludeFromCoverage
class MissingScopeInitializer : Initializer<Unit> {
override fun create(context: Context) {

View File

@ -6,6 +6,6 @@ publishOption.shouldBePublishedAsLib = false
// Global minimum coverage percentage.
protonCoverage {
minBranchCoveragePercentage.set(36)
minBranchCoveragePercentage.set(27)
minLineCoveragePercentage.set(48)
}

View File

@ -25,7 +25,9 @@ import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.components.SingletonComponent
import me.proton.core.crypto.validator.presentation.CryptoValidator
import me.proton.core.util.kotlin.annotation.ExcludeFromCoverage
@ExcludeFromCoverage
public class CryptoValidatorInitializer : Initializer<CryptoValidator> {
public override fun create(context: Context): CryptoValidator {

View File

@ -24,7 +24,9 @@ import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.components.SingletonComponent
import me.proton.core.util.kotlin.annotation.ExcludeFromCoverage
@ExcludeFromCoverage
class HumanVerificationInitializer : Initializer<Unit> {
override fun create(context: Context) {

View File

@ -25,7 +25,9 @@ import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.components.SingletonComponent
import me.proton.core.keytransparency.data.SelfAuditStarter
import me.proton.core.util.kotlin.annotation.ExcludeFromCoverage
@ExcludeFromCoverage
public class KeyTransparencyInitializer : Initializer<Unit> {
override fun create(context: Context) {

View File

@ -25,7 +25,9 @@ import dagger.hilt.InstallIn
import dagger.hilt.android.EntryPointAccessors
import dagger.hilt.components.SingletonComponent
import me.proton.core.network.presentation.UnAuthSessionFetcher
import me.proton.core.util.kotlin.annotation.ExcludeFromCoverage
@ExcludeFromCoverage
public class UnAuthSessionFetcherInitializer : Initializer<UnAuthSessionFetcher> {
public override fun create(context: Context): UnAuthSessionFetcher {

View File

@ -34,7 +34,9 @@ import me.proton.core.plan.presentation.usecase.CheckUnredeemedGooglePurchase
import me.proton.core.presentation.app.AppLifecycleProvider
import me.proton.core.util.kotlin.CoroutineScopeProvider
import me.proton.core.util.kotlin.DispatcherProvider
import me.proton.core.util.kotlin.annotation.ExcludeFromCoverage
@ExcludeFromCoverage
class UnredeemedPurchaseInitializer : Initializer<Unit> {
override fun create(context: Context) {
val entryPoint = EntryPointAccessors.fromApplication(

View File

@ -4,7 +4,7 @@ import kotlinx.kover.gradle.plugin.dsl.KoverReportFilters
internal fun KoverReportFilters.androidRules() {
excludes {
annotatedBy("androidx.compose.runtime.Composable")
annotatedBy("me.proton.core.util.kotlin.annotation.ExcludeFromCoverage")
classes(
"*Activity",
"*Activity\$*",

View File

@ -203,6 +203,9 @@ public final class me/proton/core/util/kotlin/WhenExensionsKt {
public static final fun getExhaustive (Ljava/lang/Object;)Ljava/lang/Object;
}
public abstract interface annotation class me/proton/core/util/kotlin/annotation/ExcludeFromCoverage : java/lang/annotation/Annotation {
}
public abstract interface class me/proton/core/util/kotlin/coroutine/ResultCollector {
public abstract fun key ()Ljava/lang/String;
public abstract fun onComplete (Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;

View File

@ -0,0 +1,26 @@
/*
* Copyright (c) 2022 Proton Technologies AG
* This file is part of Proton AG and ProtonCore.
*
* ProtonCore is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ProtonCore is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProtonCore. If not, see <https://www.gnu.org/licenses/>.
*/
package me.proton.core.util.kotlin.annotation
@Retention(AnnotationRetention.BINARY)
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.FUNCTION
)
public annotation class ExcludeFromCoverage