GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [apex] CyclomaticComplexity: False negative with switch statements · Issue #4863 · pmd/pmd Closed Labels a:false-negativePMD doesn't flag a problematic piece of codein:documentationAffects the documentation [doc] Milestone DescriptionI'm happy to fork the repo and have a go at fixing this if you're happy to accept the changes once you're happy with them. Affects PMD Version: 6.55 Rule: Description: The cyclomatic complexity of a method should be increased by adding a Moreover, the documentation states that it covers:
Which is not only not true, but also syntactically incorrect, as in Apex the keyword Code Sample demonstrating the issue: public class CyclomaticComplexity { void foo() { switch on Trigger.operationType { when BEFORE_INSERT { System.debug('Before Insert'); } when AFTER_INSERT { System.debug('After Insert'); } } } } Expected outcome: PMD should report a cyclomatic complexity of 3 (starts at one, then +1 for each branch in the switch). It actually reports a cyclomatic complexity of 1. Running PMD through: CLI Activity
MetadataMetadataAssigneesLabelsa:false-negativePMD doesn't flag a problematic piece of codein:documentationAffects the documentation [doc] TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |