Tools for effectively checking Java code: PMD, Checkstyle, FindBugs, Jalopy__java

Source: Internet
Author: User
Tags checkstyle
A PMD document that examines the following sections of code:
Unused local variables
An empty catch block
Parameter not used
Empty if statement
Duplicate import statement
Unused private methods
Could be a singletons class.
Short/Long variable and method name

Checkstyle Check the following sections:
Javadoc annotation
Naming conventions
Title
Import statement
Volume size
Blank
Modifiers
Block
Mixed Check (pack live some useful, such as System.out and Printstacktrace)

Their role
Unlike Pmd,checkstyle, which can check Javadoc annotations, PMD provides a useful feature called CPD that examines the copy and paste portions of code. The most frequent errors I have found using PMD are unused import statements, unused private variables, and unexpected repeat spelling. Checkstyle can find more errors. Includes a missing Javadoc annotation, more than 80-character lines, an inconsistent variable name, a tab instead of a space, and so on. All two tools allow you to create custom rules.
If you want to use one of them in your organization, Checkstyle seems better: it checks most of the projects agreed by the company code. If improving code quality is the primary goal, then PMD is a good choice. But if you want more features and really use tools to modify the code, you should try jalopy.
  
Jalopy

Jalopy is an easily configurable source code format program that detects and fixes a large number of custom bugs in Java code. Jalopy is more like a code-builder than an inspector. Jalopy's plug-ins now support most Ides, and most are seamless integration. I find that jalopy is particularly powerful and can do a lot of cool things. For example, it can modify code indentation, align parentheses, make line widths conform to a character length, insert related Javadoc annotations, and sort import statements. The best place to Jalopy is the Super customization feature. A simple user interface allows you to select all the features of the jalopy switch without requiring an XML configuration file.


Findbugs

1. Official Web site: http://findbugs.sourceforge.net,
Download Address: http://sourceforge.net/projects/findbugs/files/findbugs%20eclipse%20plugin/,
Download Edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821.zip;
2. Extract to "E:\MyEclipse6.5\eclipse\features" and "E:\MyEclipse6.5\eclipse\plugins"; Or the entire edu.umd.cs.findbugs.plugin.eclipse_1.3.9.20090821 file to plugins, note JDK version, such as 3 can only be above jdk7
(2.2. Or online Installation: Help->installnew software--) Click "Add", then in the pop-up "Name" type "findBugs", "Location" input "http://" Findbugs.cs.umd.edu/eclipse can be)
3. Restart MyEclipse;
4.FindBugs View: window->showview->other->findbugs;
5. How to: Select Item Right click->findbugs->findbugs;

-------------------

Code Check Specification Checkstyle and PMD are used in combination:

1. For an item, you can right-click on the PMD check to see Check Code with PDM to see some of the nonstandard issues of using underscores when declaring variables.
2. Can also use Chenkstyle to check, can combine to use.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.