PMD Tutorial

In this tutorial I'll introduce another tool to help find possible problems in your code, PMD. It will check for empty blocks, unused variables or parameters, extremly complex expressions, etc.

Just like CheckStyle, it offers an command-line tool as well as many IDE plug-ins. In this article, the PMD Eclipse plug-in will be introduced.

 

1. First and foremost, if you intend to install the plug-in via the Eclipse market, DO NOT use the URL provided on its homepage because it has expired. Instead, you can visit that URL directly in your browser, and in that page there's the updated link for this plug-in.

 

 

2. As long as you have got the valid URL, it's pretty simple to install it in Eclipse. Just click Help -> Install new software. In the opened dialogue, click "Add". Type in the name ("PMD") and the URL. Click "OK" to proceed.

 

3. Then select "PMD" and click "Next".

 

4. Eclipse will begin downloading the software. Agree to any prompted licenses or user agreements to proceed.

 

5. To finish the installation, restart Eclipse.

 

6. Right-click the project, select "Properties" in the context menu. In the opened dialogue, search for "PMD" in the left column and click on it. Then select "Enable PMD" for this project.

 

7. Right-click the project again, then select PMD -> Check Code. PMD will then begin to check for possible inconformities in this project.

 

 8. When finshed, the PMD perspective will open, showing any violations it has found.

 

 9. Make changes accordingly, and save the file. Re-check the code using PMD to ensure that the violations has been properly edited.

 

OK. That's all for this simple tutorial. You can visit its website (http://pmd.sourceforge.net) for more information.

 

Feedbacks and suggestions are greatly appreciated.

 

转载于:https://www.cnblogs.com/tuhz/p/4520769.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值