Tool that finds pieces of code without thorough coverage of exceptional states
I would like to find a good tool that will analyze my code and find possible problems with missing exceptional states handling, like null checking, numerical overflows ect..
Any recommendations?
Edit: this was retlated to testing too i.e. how to find sp开发者_开发技巧ots that are weakly covered by tests.
Personally, I use PMD and Findbugs:
- http://pmd.sourceforge.net/
- http://findbugs.sourceforge.net/
There's a lot of overlap between those two, but you can configure custom rulesets and rules for both of them, and you can also code your own rules if you want.
Unfortunately, what any static analysis tools can do with regards to finding potential problems with exceptional states is somewhat limited. Having said that, both of these tools has pointed out problems in code I've worked on that would have wasted a lot of time to debug if a client had found the problem after we released.
[EDIT] To cover the dynamic part of the code, use EclEmma and unit tests. EclEmma uses Emma internally, which you could use without Eclipse as well.
A good IDE like Netbeans or Eclipse should do that as wide as it's possible. The Compilers messages should help, too.
The rest is up to you (that means: testing, testing and testing).
精彩评论