Last active
May 26, 2021 20:57
-
-
Save rsoesemann/8a612d9b28d9c572dfb203c9769a5809 to your computer and use it in GitHub Desktop.
PMD ruleset with custom XPath rule "AvoidProductionDebugLogs"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<ruleset xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Default ruleset used by the CodeClimate Engine for Salesforce.com Apex" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> | |
<description>Default ruleset for PMD/Codacy</description> | |
<!-- CUSTOM RULES --> | |
<rule name="AvoidProductionDebugLogs" language="apex" class="net.sourceforge.pmd.lang.apex.rule.ApexXPathRule" | |
message="Avoid leaving System.debug() statments in code as they negativly influence performance."> | |
<description>Avoid leaving System.debug() statments in code as they negativly influence performance.</description> | |
<priority>3</priority> | |
<properties> | |
<property name="xpath"> | |
<value><![CDATA[ | |
//MethodCallExpression[@FullMethodName='System.debug'][count(*)=2] | |
]]></value> | |
</property> | |
</properties> | |
<example><![CDATA[ | |
// this is OK | |
System.debug(LoggingLevel.ERROR, 'Failure'); | |
// but this is not | |
System.debug('Debug' + var); | |
]]></example> | |
</rule> | |
</ruleset> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment