Skip to content

Conversion to Enhance Switch for AnnotationUseStyle Check Causing Jacoco Coverage Issue #17674

@AmitKumarDeoghoria

Description

@AmitKumarDeoghoria

From comment : #17667 (comment)
Inspection Error:
</problem> <problem> <file>file://$PROJECT_DIR$/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java</file> <line>223</line> <module>project</module> <package>com.puppycrawl.tools.checkstyle.checks.annotation</package> <entry_point TYPE="method" FQNAME="com.puppycrawl.tools.checkstyle.checks.annotation.SuppressWarningsCheck void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST ast)"/> <problem_class id="EnhancedSwitchMigration" severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement can be replaced with enhanced 'switch'</problem_class> <description>Switch statement can be replaced with enhanced 'switch'</description> <highlighted_element>switch</highlighted_element> <language>JAVA</language> <offset>24</offset> <length>6</length> </problem> </problems>
On Conversion to Enhance switch cases we see the coverage going down from 1 to 0.98

Image
[INFO] --- jacoco:0.8.14:check (default-check) @ checkstyle ---
[INFO] Loading execution data file /Users/runner/work/1/s/target/jacoco.exec
[INFO] Analyzed bundle 'checkstyle' with 819 classes
[WARNING] Rule violated for class com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationUseStyleCheck: branches covered ratio is 0.98, but expected minimum is 1.00

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions