Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 7. Static Analysis > Source Analysis

7.2. Source Analysis

As the name implies, source analysis tools look at your source code, searching for bug patterns. The tool I used in the following code is PMD, an open source tool for Java. PMD offers a command-line version, Ant support, and plug-ins for all major development environments. It looks for problems in the following categories:


Possible bugs

For example, empty try...catch blocks


Dead code

Unused local variables, parameters, and private variables


Suboptimal code

Wasteful string usage


Overcomplicated expressions

“Reuse” via copy and paste


Duplicate code (supported by an ancillary tool called CPD)

“Reuse” via copy and paste


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial