11

Possible Duplicate:
Static Analysis tool recommendation for Java?

I have to find a java code analysis or inspection tool which can customized with user defined rule. Actually, I have to make some static code in my workspace to non-static. a tool where i can write some rules like if such a code is encountered in entire workspace then do something.

Can anyone suggest something.

Community
  • 1
  • 1
Vikas Sharma
  • 136
  • 1
  • 2
  • 6

4 Answers4

10

You can use

  1. Google CodePro Analytix (Free)(one of my favourate tool),

  2. SpotBugs (formerly known as Findbugs)

  3. PMD

  4. Checkstyle

  5. Sonar - It's also good because it integrates all Findbugs, PMD, Checkstyle in one place and very well dashboard reporting available

p.campbell
  • 98,673
  • 67
  • 256
  • 322
arshwarsi
  • 182
  • 1
  • 8
3

PMD is extensible. The rules are file based and can be coded either in Java or XPath.

Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
  • 1
    been there... in large project 90% of the problems pmd finds are worthless, so you end up with "// no pmd" comment :) – aviad Mar 07 '12 at 06:30
  • The trick with PMD is that you limit the rule set to the rules you really want to use. If you activate 100%, then of course, most results are not useful. But that's not the way to do it ;) ([Best Practices](http://pmd.sourceforge.net/bestpractices.html)) – Andreas Dolk Mar 07 '12 at 06:34
  • any good set of rules you came across? The best practices sucks as well... I'd appreciate you sharing this info. – aviad Mar 07 '12 at 06:37
  • 2
    There is no "good" set of rules. If you do serious coding, you agree on a few rules within your team, activate them, put them on warning first and on error (= breaks build) after a some weeks/months. It's a tool. It does not *make* better software. *You* define your quality standards, pmd (and all the other tools) help in reaching and keeping *your* standards. – Andreas Dolk Mar 07 '12 at 09:19
3

If you want standalone tool http://www.sonarsource.org/ provides static analysis by using PMD, Findbugs, Checkstyles etc. You can define your own importance levels for all rules and modify rules.

It also integrates to Eclipse.

2

1.pmd

2.findbugs

3.checkstyle

I found pmd is very useful.

Balaswamy Vaddeman
  • 8,360
  • 3
  • 30
  • 40