[ANN] MetricsReloaded 0.4 release

Announcing the release of MetricsReloaded 0.4. MetricsReloaded is a plugin to IntelliJ IDEA which calculates and displays a large number of source code metrics for any IDEA project. MetricsReloaded is designed for use in project tracking, quality assurance, and developer training. Over 210 metrics are currently available at the project, module, package, class, and method levels. Metrics can be sorted, graphed, compared with previous metrics runs, and exported to file. MetricsReloaded is available via the Plugin Manager.

MetricsReloaded is only supported against the EAP 4.5 version of IDEA.

Using MetricsReloaded:
In use, MetricsReloaded acts much like the "Inspect Code..." panel built into IDEA, except that instead of finding code weaknesses, it calculates numeric values about the code. MetricsReloaded can be run from the main menu (under Analyze/Calculate Metrics...) or by right-clicking in the Project or Package views, or in the editor. If selected from the main menu, metrics will be calculated for all files in the project. If selected from the Project or Package views, metrics are calculated for the selected file, package, directory, or module. If selected in the editor, metrics will only be calculated for the active file. Next, a panel will appear, asking whether you wish to calculate metrics for all java files, only product files, or only test files. After you've selected here, you are then shown the main metrics configuration panel. Like choosing inspections in the inspection panel, the metrics configuration panel lets you choose which metrics you wish to run. Also like the inspection panel, the user may create multiple named inspection profiles, allowing him to have standard sets of metrics to run for different uses. Finally, the metrics configuration panel allows the user to configure thresholds for each metric. Metrics values which are outside of the selected threshold values will be highlighted in the metrics display. When calculation is complete, the metrics display panel will be become visible. The metrics display panel consists of a tabbed set of tables, filled with metrics values. Metrics values can be sorted on any column, saved as a snapshot file, compared with values from a previous snapshot file, or exported to a comma-separated value (.csv) file or XML file. By right-clicking on a column, that metric's values may be displayed in a histogram, distribution graph, or pie chart (if appropriate). It should all be pretty obvious.

Metrics Currently Supported
Project Metrics
Average cyclomatic complexity
Comment lines of code
Comment ratio
Javadoc class coverage
Javadoc field coverage
Javadoc lines of code
Javadoc method coverage
Lines of code
Lines of product code
Lines of test code
Number of abstract classes
Number of classes
Number of concrete classes
Number of interfaces
Number of methods
Number of packages
Number of product classes
Number of test classes
Number of top-level classes
Number of top-level interfaces
Source lines of code
Test ratio
Total cyclomatic complexity
True comment ratio
Module Metrics
Average cyclomatic complexity
Comment lines of code
Comment ratio
Encapsulation ratio
Javadoc class coverage
Javadoc field coverage
Javadoc lines of code
Javadoc method coverage
Lines of code
Lines of product code
Lines of test code
Number of classes
Number of abstract classes
Number of concrete classes
Number of interfaces
Number of methods
Number of product classes
Number of test classes
Number of top-level classes
Number of top-level interfaces
Source lines of code
Test ratio
Total cyclomatic complexity
True comment ratio
Package Metrics
Abstractness
Afferent coupling
Average cyclomatic complexity
Comment lines of code
Comment lines of code (recursive)
Comment ratio
Comment ratio (recursive)
Distance to main sequence
Efferent coupling
Encapsulation ratio
Instability
Javadoc class coverage
Javadoc class coverage (recursive)
Javadoc field coverage
Javadoc field coverage (recursive)
Javadoc lines of code
Javadoc lines of code (recursive)
Javadoc method coverage
Javadoc method coverage (recursive)
Lines of code
Lines of code (recursive)
Lines of product code
Lines of product code (recursive)
Lines of test code
Lines of test code (recursive)
Number of abstract classes
Number of abstract classes (recursive)
Number of classes
Number of classes (recursive)
Number of concrete classes
Number of concrete classes (recursive)
Number of dependent packages
Number of interfaces
Number of interfaces (recursive)
Number of methods
Number of methods (recursive)
Number of package dependencies
Number of product classes
Number of product classes (recursive)
Number of test classes
Number of test classes (recursive)
Number of top-level classes
Number of top-level classes (recursive)
Number of top-level interfaces
Number of top-level interfaces (recursive)
Source lines of code
Source lines of code
Test ratio
Total cyclomatic complexity
True comment ratio
True comment ratio (recursive)
Interface Metrics
Adjusted level order
Comment lines of code
Comment ratio
Coupling between objects
Interface size (attributes)
Interface size (operations + attributes)
Interface size (operations)
Javadoc field coverage
Javadoc lines of code
Javadoc method coverage
Level order
Lines of code
Number of commands
Number of cyclic dependencies
Number of dependencies
Number of dependent packages
Number of dependents
Number of implementations
Number of package dependencies
Number of queries
Number of subinterfaces
Number of transitive dependencies
Number of transitive dependents
Source lines of code
True comment ratio
Class Metrics
Adjusted level order
Average number of parameters
Average operation complexity
Average operation size
Class size (attributes)
Class size (operations + attributes)
Class size (operations)
Comment lines of code
Comment ratio
Coupling between objects
Depth of inheritance tree
Halstead bugs
Halstead difficulty
Halstead effort
Halstead length
Halstead vocabulary
Halstead volume
Javadoc field coverage
Javadoc lines of code
Javadoc method coverage
Level order
Lines of code
Maximum operation complexity
Maximum operation size
Number of attributes added
Number of attributes inherited
Number of commands
Number of constructors
Number of cyclic dependencies
Number of dependencies
Number of dependent packages
Number of dependents
Number of inner classes
Number of interfaces implemented
Number of operations added
Number of operations inherited
Number of operations overridden
Number of package dependencies
Number of queries
Number of statements
Number of subclasses
Number of transitive dependencies
Number of transitive dependents
Source lines of code
True comment ratio
Weighted method complexity
Method Metrics
Comment lines of code
Comment ratio
Conditional nesting depth
Control density
Cyclomatic complexity
Design complexity
Essential cyclomatic complexity
Extended cyclomatic complexity
Halstead bugs
Halstead difficulty
Halstead effort
Halstead length
Halstead vocabulary
Halstead volume
Javadoc lines of code
Lines of code
Loop nesting depth
Nesting depth
Number of branch statements
Number of control statements
Number of exceptions caught
Number of exceptions thrown
Number of executable statements
Number of expressions
Number of implementations
Number of loop statements
Number of method calls
Number of overriding methods
Number of parameters
Number of return points
Number of statements
Number of times called
Number of times called in product code
Number of times called in test code
Number of type cast expressions
Quality Criteria Profile (Correctness)
Quality Criteria Profile (Maintainability)
Quality Criteria Profile (Reliability)
Relative lines of code
Source lines of code
True comment ratio


Caveats:
MetricsReloaded is available in beta form. This implies that there are certain to be bugs still in the code. Users of MetricsReloaded are encouraged to report bugs on the IDEA Plugins forum.

Changes since 0.3
-


40 new metrics added, including transitive and cylic dependency metrics, method call counts, and recursive package metrics.
Export to XML supported.
Many bug fixes, performance enhancements, and general code improvements.


Terms of use:
MetricsReloaded is public domain software, available in either binary or source form for any use, commercial or non-commercial. In particular, inclusion of MetricsReloaded in the core IntelliJ IDEA product is expressly allowed and desired. The graphing functionality of MetricsReloaded is provided by the open source JFreeChart library (www.jfree.org). JFreeChart is available under the GNU Lessser General Public License, a copy of which is included with the MetricsReloaded distribution. Any redistribution of MetricsReloaded or JFreeChart is expected to follow the letter and spirit of that license.

Important Admonition:
The primary purpose of MetricsReloaded is to allow developers and quality assurance personnel greater insight into their code, so as to help them find weaknesses and places for improvement. As a secondary purpose, MetricsReloaded can be used by individual developers as a project management tool, to track their efforts and help them improve their estimates. The one thing MetricsReloaded shouldn't be used for however, is development management. USING THE NUMBERS CREATED BY METRICSRELOADED FOR PURPOSES OF RANKING DEVELOPER OUTPUTS FOR HIRING, REVIEW, PROMOTION, OR RETENTION IS DISCOURAGED IN THE STRONGEST TERMS.

6 comments
Comment actions Permalink

Dave


Got an NPE while running this against my code in build 2214.


Thanks!

Todd Breiholz

0
Comment actions Permalink

Hello,

can I use this from an ant task?
When yes, please write how to use it.

Regards,
Juergen Melzer

0
Comment actions Permalink


An Ant task is in plan for future releases of MetricsReloaded, but isn't available at present. When it's there, I'll certainly document it.

--Dave Griffith

0
Comment actions Permalink

I really love the concept of this plugin, but I find that in practice that alot of metrics are useless for a lot of our codebase.

For example, when we write SQL queries (all encapsulated behind a nice wall of abstraction, of course) in our DAO implementation methods, we like to store them as static final String objects and format them nicely with String concatenation so that they are easier to read (since they are static final, there is no performance impact). To illustrate:


Since some queries can be long, there can be several + signs, which completely throws off a ton of metrics.

The other place I notice this is in Struts ActionForms where we've used the generateToString plugin and there are a lot of fields. It will create a method like:


Once again, in a class with a lot of fields (which can happen with Form objects that are just mapped to value objects later), the large number of + signs marks a class that is nothing but getters and setters as tremendously complex code.

So I'm wondering if there is any way to alter this behaviour, and if not, are there plans to do so?

0
Comment actions Permalink


Hmm, off the top of my head, only the Halstead metrics should be impacted by static string concatenations like that, but your essential point is correct. I'll revisit the applicable metrics so that compile-time-resolvable string concatenations are not counted as increasing code complexity any more than an equivalent string literal would.

--Dave Griffith

0
Comment actions Permalink

Suggestion for some new metrics:

Some form of LCOM or a measure of cohesion in general.
A measure of polymorphism, such as polymorphism factor (abreu metric) or some other to measure polymorphism.
Number of hierarchies (or is this there already?).
Measure of aggregation (number of fields of other class types, not primitives).

If i can get some of these from the existing metrics, please let me know. I hope you implement them :).

And thanks for the great plugin!

0

Please sign in to leave a comment.