Code Static analysis Tool--pmd,findbugs,checkstyle

Source: Internet
Author: User
Tags checkstyle

Recently Learning MyBatis official documents, see the "Project Document" section has a lot of content has not seen, make a note, understand.

  

PMD Scans the Java source code to look for potential problems such as:

    • Possible bugs, such as an empty Try/catch/finally/switch declaration
    • Dead code, no local variables, parameters and private methods used
    • Non-standard code, such as String/stringbuffer usage
    • Overly complex expressions, such as unnecessary if expressions
    • Duplicate code, copy, paste the code

FindBugs It is used to find bugs that exist in Java code. It uses the static analysis method to identify hundreds of potential different types of errors in Java programs.

Checkstyle It defines a series of available modules, each of which provides a strict degree of rigor (mandatory, optional ...) A configurable check rule . Rules can trigger notifications (notification), warnings (warning), and errors (error).

There are a lot of ways to see the results of these tools now:

    • XML Format : These tools can produce XML files that can be used to produce HTML reports or to be used by other tools to browse the results of the analysis.
    • HTML format : HTML format is the most popular way to generate reports and share between teams, and you can also create your own reports with XSL tables.
    • IDE Plugin : Almost all the named Ides provide plugins for these tools, which makes it almost possible to discover all the problems that exist in the source code.

One problem with code quality tools is that they sometimes give developers a lot of errors that are not errors-also called false positives (false positives). When this happens, developers can learn to ignore the output of the tool or discard all of the output.

To better utilize the output of these tools , give developers a more useful view, preferably with a way of focusing only on what we want. In this article, we'll find other interesting ways to better utilize the output of all of these well-known Java static analysis tools, and then query those results as you would query a database.

Jarchitect and Cqlinq

Jarchitect is another static analysis tool that makes up for other tools that use a LINQ (CQLINQ)-based Code query language to query the code like a database query.

The previous version of JARCHITECT3 can only query the analysis data extracted from the Jarchitect, but from the JARCHITECT4, it is possible to include the output of many other static analysis tools, and then use CQLINQ to do the query.

This is the project manager used to count the amount of work, haha. 

Reference: How to better utilize PMD, findbugs and Checkstyle analysis results

 

Code Static analysis Tool--pmd,findbugs,checkstyle

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.