Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top level verification rule is not applied to verification tasks for Android build variants #459

Closed
nashcft opened this issue Sep 17, 2023 · 1 comment · Fixed by #502
Closed
Assignees
Labels
Bug Bug issue type Kover Gradle Plugin S: ready for release Status: merged in the main branch

Comments

@nashcft
Copy link

nashcft commented Sep 17, 2023

Describe the bug

From descriptions in the docs, top level verification rule should be applied to all variants including Android build variants:

// verification rules for verification tasks in all variants

Rules can be specified for all report variants:

koverReport {
    verify {
        rule {
            minBound(50)
        }
    }
}

But it seems that only default verification task (i.e. koverVerify) verifies coverage report based on the top level rule and Android report verification tasks (i.e. koverVerify{VariantName}) do not use the rule.

Errors

No error is found.

Expected behavior

Verification rule for all report variants is applied to Android report variants, which are executed by koverVerify{VariantName}, as well as default report.

Reproducer

I created a reproducer project: https://github.com/nashcft/repro-kover-verification

Reports

Following screenshot shows the result of verification task executions on the reproducer project mentioned above. Note that the verification for release variant in the capture is failed because the variant has variant-specific verification rule.

Screenshot 2023-09-17 at 13 22 36

Environment

  • Kover Gradle Plugin version: 0.7.3
  • Gradle version: 8.2
  • Kotlin project type: confirmed with Kotlin/Android and Kotlin/Multiplatform + Android
  • Coverage Toolset (if customized in build script): Kover
  • Other context important for this bug:
    • OS: macOS Ventura 13.5.2
@nashcft nashcft added Bug Bug issue type S: untriaged Status: issue reported but unprocessed labels Sep 17, 2023
@shanshin shanshin added S: confirmed Status: bug is reproduced or present Kover Gradle Plugin and removed S: untriaged Status: issue reported but unprocessed labels Sep 18, 2023
shanshin added a commit that referenced this issue Nov 6, 2023
Now, when creating the Android report configuration, on Check is immediately set for verification.

This is not necessary, because if not specified, only the `koverVerify` task is started when executing check, but not the tasks of verifying Android build variant.
This has a negative side effect, because the verification for the build variant is always specify, and it will override the common rules from the root of the report config `koverReport { verify { /* common rules */ }  }`

Fixes #459
shanshin added a commit that referenced this issue Nov 14, 2023
Now, when creating the Android report configuration, on Check is immediately set for verification.

According to the rules for Android reports, if onCheck is not specified, it is taken as false.

Now, to install onCheck, the reports.verify { block is called.
if you look at its implementation, you can see that the default value for verify config is null.
When a user writes verify { }, according to the current rules, it automatically resets all filters declared in the hierarchy above.

The problem was that the onCheck setting took place through a verify block call, which should be filled in by the user, so the filters seem to be erased.

Fixes #459
PR #502
@shanshin shanshin reopened this Nov 15, 2023
@shanshin shanshin added S: ready for release Status: merged in the main branch and removed S: confirmed Status: bug is reproduced or present labels Nov 15, 2023
@shanshin
Copy link
Collaborator

Fixed in 0.7.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug issue type Kover Gradle Plugin S: ready for release Status: merged in the main branch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants