DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Securing Your Software Supply Chain with JFrog and Azure
Register Today

Trending

  • Reactive Programming
  • Strategies for Reducing Total Cost of Ownership (TCO) For Integration Solutions
  • Alpha Testing Tutorial: A Comprehensive Guide With Best Practices
  • Front-End: Cache Strategies You Should Know

Trending

  • Reactive Programming
  • Strategies for Reducing Total Cost of Ownership (TCO) For Integration Solutions
  • Alpha Testing Tutorial: A Comprehensive Guide With Best Practices
  • Front-End: Cache Strategies You Should Know
  1. DZone
  2. Coding
  3. Java
  4. Code Quality Tools in Java

Code Quality Tools in Java

Peter Karussell user avatar by
Peter Karussell
·
May. 25, 09 · Interview
Like (1)
Save
Tweet
Share
65.61K Views

Join the DZone community and get the full member experience.

Join For Free

there are several tools to measure the code quality. the ones i have tried with a lot of success are:

  • findbugs (latest version 1.3.8) – uses static analysis to look for bugs in java code . this is a great tool, it discovered possible nullpointerexceptions and a lot more bugs in my projects. sometimes i asked myself how this program could have discovered this ‘complicated’ bug. with the maven plugin you can do:
    mvn findbugs:findbugs

    which will use version 1.3.8 out of the box

  • pmd (latest version 4.2.5) – scans java source code and looks for potential problems . the rules are configurable, but at the beginning you will only need the provided one (and spend a lot of time to choose your favourites ;-) )in netbeans 6.5 this tool is well integrated and works like a charme (ctrl+alt+p).

    with the maven plugin you can do:

    mvn pmd:pmd

    after you specified the following in the pom.xml under<reporting> <plugins> :

    <plugin>
    <groupid>org.apache.maven.plugins</groupid>
    <artifactid>maven-pmd-plugin</artifactid>
    <version>2.3</version>
    <configuration>
    <targetjdk>1.5</targetjdk>
    </configuration>
    </plugin>

other tools could be

  • jaranalyzer – is a dependency management utility for jar files. it’s primary purpose is to traverse through a directory, parse each of the jar files in that directory, and identify the dependencies between the jar files.
  • hammurapi – a code quality governance platform

but i haven’t tried them so far.

for findbugs  and pmd there is a netbeans plugin ( sqe … software quality environment ) which looks promising, but fails with a nullpointerexception after i installed it via the update center and tried it on my project. maybe i should use one of the snapshots . (btw: i successfully used the pmd-plugin and findbugs in the standalone version).

sonar is another interesting approach to use several code quality tools at a time. with sonar it is possible to see the violations or possible bugs over das or weeks  – so, you are looking at the improvements and you will not get lost in the mass of bugs at the beginning. another “multi-tooling” project is xradar .

a little bit offtopic, but a great tool is proguard, which shrinks, optimizes, obfuscates and preverifies java class files. there is even a maven plugin for that.

from http://karussell.wordpress.com/

Java (programming language)

Opinions expressed by DZone contributors are their own.

Trending

  • Reactive Programming
  • Strategies for Reducing Total Cost of Ownership (TCO) For Integration Solutions
  • Alpha Testing Tutorial: A Comprehensive Guide With Best Practices
  • Front-End: Cache Strategies You Should Know

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: