The Artima Developer Community
Sponsored Link

Java Community News
PMD 3.9 Released

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

PMD 3.9 Released Posted: Dec 22, 2006 4:14 PM
Reply to this message Reply
Summary
PMD is a Java code quality tool that scans Java source files, and matches a large set of rules on that source code to find potential bugs, errors, or just plain poor coding style. PMD's new 3.9 version includes a dozen additional rules, and provides a significant performance boost as well.
Advertisement

PMD is Java source scanner that inspects source code in order to identify potential problems. For example, PMD can find empty try-catch blocks, unnecessary if statements and for loops, unused variables, parameters, and private methods, and pinpoints duplicated code, i.e., code that resulted from copying-and-pasting from one area of a code base into another.

PMD relies on a set of rules about code in order to identify those problems. PMD's rules are grouped into rule sets, with sets addressing issues from basic coding style to code size, logging, String usage, unit testing, or JavaBeans and JSP pages.

The PMD projects released PMD 3.9 with several new rules:

  • BigIntegerInstantiation ensures that you don't unnecessarily initialize BigIntegers for which a constant is already defined, such as BigInteger.ZERO or BigInteger.ONE

  • The AvoidUsingOctalValues checks that you didn't inadvertently place a zero in front of integer constants: Doing so would cause the compiler to interpret those integers as octal values.
  • NPathComplexity. According to the PMD documentation:

    NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

  • NcssTypeCount counts type declarations, including classes as well as enums and annotations.
  • NcssMethodCount counts the size of all non-constructor methods.
  • NcssConstructorCount counts constructor declarations, including any explicit super() calls.
  • UseCollectionIsEmpty checks if you're trying to compare the size of a collection to 0, as the Collection interface's isEmpty() method should be used to find if a collection has any elements.
  • StringBufferInstantiationWithChar If you try to instantiate a StringBuffer with an char, as in new StringBuffer('c'), the char will be converted to an int to initialize the StringBuffer's size.

What code checking rules do you find most useful in your projects?

Topic: GNU Classpath 0.93 Released Previous Topic   Next Topic Topic: JavaScript's Language Features

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use