This Eclipse plugin calculates various metrics for your code during build cycles and warns you, via the Problems view, of 'range violations' for each metric. This allows you to stay continuously aware of the health of your code base. You may also export the metrics to HTML for public display or to CSV format for further analysis.
Note that although metrics can be useful in a software development effort, they should not take the place of good taste and experience. Also, metrics are more useful as indicators of unhealthy code than they are as indicators of healthy code, i.e. a codebase with many range violation warnings is probably an indication that the code needs to be refactored but no range violation warnings does not necessarily mean that the code is good.
Enabling / Disabling
The metric plugin is enabled and disabled per Java project. Open the project's Properties, select the 'Metrics' tab and check or uncheck the 'Enable Metrics Gathering' checkbox. Clicking 'OK' now causes the project to recompile (assuming your preferences are set up to perform automatic builds) and metrics will be recalculated. If any metrics are out of range, warnings will be added to the Problems View and the code will also be marked up.
Exporting metrics in HTML or CSV Format
To export the metrics for a project, pop up the context sensitive menu on any resource in the prject and select 'Export' Chose the 'Metrics' export wizard and select the directory you want to export to and the export formats you require.
When exporting HTML, you can elect to create a histogram for each metric (this does not work on Mac OSX due to some issues with the SWT implementation). The appropriate metric's histogram will be displayed on each page.
Click here to know more about: http://eclipse-metrics.sourceforge.net/
Recommend the tutorial