From abbe46c7ba3c15d8dcbc1b603466e5c25754cbbd Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Wed, 1 Apr 2020 09:25:09 +0100 Subject: [PATCH] Add another test for variable usage in blocks --- .../rule/bestpractices/xml/UnusedLocalVariable.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/bestpractices/xml/UnusedLocalVariable.xml b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/bestpractices/xml/UnusedLocalVariable.xml index 0377753927..4e21cf9b26 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/bestpractices/xml/UnusedLocalVariable.xml +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/rule/bestpractices/xml/UnusedLocalVariable.xml @@ -37,6 +37,16 @@ public class Foo { String x = 'blah'; return [SELECT Id FROM Account WHERE Name = :x]; } + + public String usageInBlocks(Boolean y) { + String x = 'used variable'; + + if (y) { + return x; + } else { + return 'some other string'; + } + } } ]]>