From 5f1b13cadd607b9ae83ab102a45aec586652fa4c Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 6 Sep 2024 19:51:52 +0200 Subject: [PATCH] [apex] Verify StdCyclomaticComplexity with triggers --- .../design/StdCyclomaticComplexityTest.java | 11 +++++++ .../design/xml/StdCyclomaticComplexity.xml | 32 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/design/StdCyclomaticComplexityTest.java diff --git a/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/design/StdCyclomaticComplexityTest.java b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/design/StdCyclomaticComplexityTest.java new file mode 100644 index 0000000000..686a99fb1a --- /dev/null +++ b/pmd-apex/src/test/java/net/sourceforge/pmd/lang/apex/rule/design/StdCyclomaticComplexityTest.java @@ -0,0 +1,11 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.apex.rule.design; + +import net.sourceforge.pmd.test.PmdRuleTst; + +class StdCyclomaticComplexityTest extends PmdRuleTst { + // no additional unit tests +} diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/design/xml/StdCyclomaticComplexity.xml b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/design/xml/StdCyclomaticComplexity.xml index 21fed889c1..a961cce7ff 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/design/xml/StdCyclomaticComplexity.xml +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/design/xml/StdCyclomaticComplexity.xml @@ -173,4 +173,36 @@ public class Test { 0 + + + StdCyclomaticComplexity for triggers + 1 + 3 + + The method 'invoke' has a Standard Cyclomatic Complexity of 4. + The trigger 'Accounts' has a Standard Cyclomatic Complexity of 4 (Highest = 4). + The method 'anotherMethod' has a Standard Cyclomatic Complexity of 3. + + +