The Artima Developer Community
Sponsored Link

Java Community News
Continuous Inspection with CheckStyle, JavaNCSS, and CPD

1 reply on 1 page. Most recent reply: Aug 2, 2006 9:03 AM by Bill Venners

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 1 reply on 1 page
Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

Continuous Inspection with CheckStyle, JavaNCSS, and CPD Posted: Aug 2, 2006 9:03 AM
Reply to this message Reply
Summary
A developerWorks article looks at using static analysis tools CheckStyle, JavaNCSS, and CPD (part of PMD) to automate portions of the usually manual process of software inspection.
Advertisement

In Automation for the people: Continuous Inspection, author Paul Duval discusses software inspection as a general technique for achieving quality, and suggests that it is a good idea to automate the low-level aspects of the inspection task, so that the manual inspection can focus on higher level issues:

Code inspections can take different forms. Some organizations use formal peer reviews, in which a developer's peers critique the code and offer ideas for improvements; other organizations exercise pairing, where one person types and the other is considering high-level design decisions and suggesting code improvements. Furthermore, some teams have another developer review their code in the form of a "desk check" before committing it to the version control repository.

Regardless of how an organization chooses to perform a code inspection, one thing is for sure: they're implicitly manual processes. And as I've found over the years, manual processes are error prone and tend to be forgotten when the going gets rough. Software inspections, however, don't always have to be manual; in fact, an entire genre of open source and commercial tools, which I dub software inspectors, are available to facilitate statically analyzing code (also known as static analysis tools).

With software inspectors, code inspections become automated through build tools like Ant or Maven. And it's through this automation that low-level source code details like coding standards, complexity, and duplication (to name a few) become the responsibility of a machine. This responsibility shift has the tendency to enhance in-person manual inspections by focusing on more high-level aspects of development, such as design and long term maintenance issues.

Duval provides working examples of using three such tools:

  • CheckStyle - for checking code style against an agreeed-upon style standard
  • JavaNCSS - for spotting code complexity
  • CPD - for detecting code duplication

The author suggests that such automated inspection tools can be run at each code change using a continuous integration tool, such as CruiseControl, so that "your team can actively improve code in real-time instead of in latter cycles." Given that running such inspection tools at each code change will generate a huge amount of data over time, he suggests installing a threshold detector that only notifies developers if, for example, a certain number of coding standards have been violated or a certain level of complexity has been detected in a certain number of classes.

To what extent have you attempted to automate code inspection? What problems does it really solve, and what problems does it create?


Nicolas Raynaud

Posts: 1
Nickname: nraynaud
Registered: Aug, 2006

Re: Contiuous Inspection with CheckStyle, JavaNCSS, and CPD Posted: Aug 2, 2006 11:55 AM
Reply to this message Reply
I suggest xradar http://xradar.sourceforge.net/ for this kind of thing.

Instead of only giving flat values, it gives also evolution charts, wich is more useful.

Flat View: This topic has 1 reply on 1 page
Topic: Continuous Inspection with CheckStyle, JavaNCSS, and CPD Previous Topic   Next Topic Topic: Scripting for the Java Platform

Sponsored Links



Google
  Web Artima.com   

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