-
Notifications
You must be signed in to change notification settings - Fork 18
Home
There is a lot of room for improvement or extension. Depending on what you want to do you eighter need to fork, extend and pull request this repository or the PMD repository.
If you want to add rules that work similarly to the ones we already have you will have to extend PMD itsself. Those are the steps you need to do:
- Install latest Eclipse IDE for Java Developers
- Fork PMD (https://github.com/pmd/pmd) [1]
- Connect your eclipse with master branch of your pmd repo [2,3]
- Import the project as general project [4]
- Delete the project, uncheck the Delete project contents on disk and copy the project location [5]
- Import them as existing Maven Projects and auto-resolve problems [6,7,8]
- Create a new rule (example AvoidDmlInLoops) [9]
- Use similar rule as starting point and adapt it [10,11]
- Add rule definition to the ruleset of its category and the complete ruleset [12,13]
- Add the rule to the according Test class [14]
- Create a new xml file for the rule with test cases [15]
- Run your tests to [16,17]
Contributions made to PMD will not be automatically used by the Code Climate engine. You have to replace the current build of PMD in the engine with new one. Those are the steps you need to do:
-
Adjust the pom.xml of PMD to get a lean build of PMD only with the required Jars, we recommend you to use our pom.xml.
-
Build PMD. Execute
mvn clean package
in the root directory of PMD. -
Unzip the generated
pmd-bin-5.5.0-SNAPSHOT.zip
in the/pmd/pmd-dist/target
directory. -
Fork the Apex Metrics engine.
-
Replace the content of
/codeclimate-apexmetrics/lib/pmd
with the content of your unzippedpmd-bin-5.5.0-SNAPSHOT
directory. -
Test and execute your custome engine locally or pull request you changes.
Beside extending the underlying PMD framework people could also add totally new mechanisms to evaluate code. Code would then not only run through PMD but also through other internal components. Just imagine using the Tooling Api and then reporting back on usused code across class boundaries as implemented by Salesforce.com MVP Andrew Fawcett.