checkstyle icon indicating copy to clipboard operation
checkstyle copied to clipboard

Issue #13553: False positive in FallThroughCheck on last case

Open Lmh-java opened this issue 1 year ago • 8 comments

Fix for Issue #13553, Continue of #14016

Config

<module name="FallThrough">
    <property name="checkLastCaseGroup" value="true"/>
</module>

Regression Report

https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/8a0a354_2024060435/reports/diff/checkstyle/index.html 5 violations are removed in Checkstyle code base. Differences in this report are intended.

For example: https://github.com/checkstyle/checkstyle/blob/4fe811819594747bcce6f62c216ea133c3cd2954/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/fallthrough/InputFallThrough4.java#L109

void method5(int i, int j, boolean cond) {
      while (true) {
          switch (i){
          case 5: // violation 'Fall\ through from the last branch of the switch statement'
              i++;
              /* block */ /* fallthru */ // comment
          }
      }
   }

This is no longer a violation in this case. Same for the other 4 cases.

Diff Regression config: https://gist.githubusercontent.com/Lmh-java/55bdd9e289522aff23374ad7b5571c2c/raw/4e52c69d3888eff5f976f0ae87c058e98c0dd72d/input-fall-thru-config.xml

Lmh-java avatar Mar 29 '24 09:03 Lmh-java

GitHub, generate report

Lmh-java avatar Mar 30 '24 05:03 Lmh-java

https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/8a0a354_2024060435/reports/diff/index.html

github-actions[bot] avatar Mar 30 '24 06:03 github-actions[bot]

@nrmancuso @romani please take a look.

Lmh-java avatar Mar 30 '24 16:03 Lmh-java

Rebasing on latest master, good to merge

nrmancuso avatar Apr 15 '24 12:04 nrmancuso

Edit: I am removing this. Property is additive, not either/or.

rnveach avatar Apr 20 '24 16:04 rnveach

GitHub, generate report

Lmh-java avatar Apr 26 '24 16:04 Lmh-java

https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/7e9dba3_2024170824/reports/diff/index.html

github-actions[bot] avatar Apr 26 '24 17:04 github-actions[bot]

Latest review discussion is at https://github.com/checkstyle/checkstyle/pull/14734#discussion_r1597719839

rnveach avatar May 13 '24 20:05 rnveach

Moved to https://github.com/checkstyle/checkstyle/pull/15405

romani avatar Jul 30 '24 13:07 romani