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.
If a duplicate code is present in: The same method, create the same Local Variable and reuse it. The same class, create common Method refactoring. Subclasses of the same hierarchy, you should Extract Method and Pull it Up. Two different classes, you can use objects.
Simply put, it's when a snippet of code appears multiple times throughout a codebase. It happens for many reasons: Somebody wanted to reuse a function in a different class, and copy-paste was the quickest solution.
SonarQube shows you all the duplications metrics on a project, package, or class basis. Further, you can use the Duplications tab in the file detail view to see the location of a duplication in a class.
You can use
Google CodePro Analytix (Free)(one of my favourate tool),
SpotBugs (formerly known as Findbugs)
PMD
Checkstyle
Sonar - It's also good because it integrates all Findbugs, PMD, Checkstyle in one place and very well dashboard reporting available
PMD is extensible. The rules are file based and can be coded either in Java or XPath.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With