10 Minutes Step by Step Guide to have PMD Plug-in and Ensure the Code Quality
Ensuring the Code quality has always been a challenge in a developer’s life. Needless to say, well written code brings down the maintenance cost. It is always good to have the code reviews by peers but actually for business logic and requirement fulfillment.
For abiding the Java Standards, it is best to have a PMD (Often called ‘Programming Mess Detector’) plug-in. It is also easy to accept the variance of standards in different projects or organizations and keep up to them. PMD gives the flexibility to alter the rules, add and delete the rules as per the programmer’s choice.
Stated below, is the step by step guide to install the PMD plug-in for Eclipse IDE and make it work with the code.
1) Open Eclipse. Go to ‘Help’ menu and click on ‘Install New Software’ and Click ‘Add’.
2) Fill in the details in appeared dialog box:
3) Click OK and it will show the available versions for installations. Choose the one you desire to install. (Generally PMD for Eclipse 3 works fine.)
4) Confirm your selection and click ‘Next’:
5) Accept the terms and conditions by clicking on the radio button and click ‘Finish’:
6) Let it download and install the jar:
7) Make sure to restart the eclipse once installation is complete.
8) Now to see the PMD violations, go to Window -> Open Perspective ->PMD. This will open the Violations Overview window.
9) Now to run the PMD rules on any project and find out the violations, right click on the project, go to PMD->Check Code with PMD. This will outline all the violations related to that project.