Skip to content

0.8.0-Beta DSL confusion between minBound and minValue. #572

@mgroth0

Description

@mgroth0

I have spent a long time being very confused, stepping through debuggers, and creating a reproducer only to find out that I was using the DSL incorrectly. I think it is a design issue, as it is too easy for users to get mixed up.

I was doing this:

kover {
    reports {
        verify {
            rule {
                bound {
                    coverageUnits.set(CoverageUnit.BRANCH)
                    minBound(75)
                }
            }
        }
    }
}

And my output kept looking like this:

Rule violated: lines covered percentage is 12.500000, but expected minimum is 75

I was very confused why it kept using lines instead of branches. Finally, I discovered I needed to do this:

kover {
    reports {
        verify {
            rule {
                bound {
                    coverageUnits.set(CoverageUnit.BRANCH)
                    minValue = 75 // <-- Change here
                }
            }
        }
    }
}

And now it works:

Rule violated: branches covered percentage is 0.000000, but expected minimum is 75

I think that the correct solution here is to use the @DslMarker annotation on all DSL objects. I mean, create an annotation called KoverDsl, annotate that annotation with @DslMarker, and put KoverDsl on all kover dsl interfaces.

Metadata

Metadata

Assignees

Labels

BugBug issue typeS: untriagedStatus: issue reported but unprocessed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions