-
Notifications
You must be signed in to change notification settings - Fork 18
Add a new rule for Apex PMD
David Renz edited this page Jun 7, 2016
·
12 revisions
TODO: Tell people about the structure of the PMD Maven modules. 1 Core and one per language. What they have to care about and what not. Which errors they can ignore. I would expect a small comment for EACH screenshot of the kind: "Cool, now we got this. Only one step left.
- Create a new java class for the rule, in our example the
AvoidDmlStatementsInLoopsRule.java
class. - Try to understand similar rules, use them as starting point.
- 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.java
class. - Create a new xml file with test cases to verify the integrity of your rule. In our example we created the
AvoidDmlStatementsInLoops.xml
. - Run the unit tests of the test class you updated in step 5.
- If all tests run successfully you are done.