-
Notifications
You must be signed in to change notification settings - Fork 19
Add a new rule for Apex PMD
David Renz edited this page May 30, 2016
·
12 revisions
We will create the AvoidDmlStatementsInLoopsRule in this showcase to give you an understanding of creating new rules.
- Create a new java class for the rule, in our example the
AvoidDmlStatementsInLoopsRule.javaclass.
- Try to understand similar rules, use them as starting point and implement your own rule.
- Add the definition of the rule to the related ruleset, in our example the category of the rule is performance, so the definition is added to the
performance.xml.
- Add the rule to the
ruleset.xml.
- Add the rule to the related test class, in our example the
PerformanceRulesTest.javaclass.
- Create a new xml file with test cases to verify the integrity of your rule. In our example we created the
AvoidDmlStatementsInLoops.xml.
- Run your unit tests.
