Branch: refs/heads/main
  Home:   https://github.com/pmd/pmd
  Commit: 866fc5afcdd959bfa9dfa9c87321807696dbe09d
      https://github.com/pmd/pmd/commit/866fc5afcdd959bfa9dfa9c87321807696dbe09d
  Author: Kurath <[email protected]>
  Date:   2026-07-24 (Fri, 24 Jul 2026)

  Changed paths:
    M docs/pages/release_notes.md
    M 
pmd-java/src/main/java/net/sourceforge/pmd/lang/java/metrics/internal/CognitiveComplexityVisitor.java
    M 
pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/metrics/impl/xml/CognitiveComplexityTest.xml

  Log Message:
  -----------
  [java] CognitiveComplexity: count switch expressions (#6883)

* [java] CognitiveComplexity: count switch expressions

CognitiveComplexityVisitor handled ASTSwitchStatement but not
ASTSwitchExpression, so a switch expression received no structural
increment and opened no nesting level. Anything nested inside it also
lost its nesting increment, and the metric came out too low.

Add visit(ASTSwitchExpression), delegating to the same structural()
helper the switch statement uses, so both forms are scored the same way.
CycloVisitor in the same package already handles both through the common
ASTSwitchLike supertype.

Fixes #6881

* Add github issue number

---------

Co-authored-by: Sören Glimm <[email protected]>



To unsubscribe from these emails, change your notification settings at 
https://github.com/pmd/pmd/settings/notifications


_______________________________________________
Pmd-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pmd-commits

Reply via email to