[ANN] MetricsReloaded 0.3 released

Announcing the release of MetricsReloaded 0.3. 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 170 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 in via the Plugin Manager, with both the executable and the source included in the package.

MetricsReloaded is only supported against the EAP 4.1 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. 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 ratio
Distance to main sequence
Efferent coupling
Encapsulation ratio
Instability
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 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
Interface Metrics
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
Lines of code
Number of commands
Number of dependencies
Number of dependent classes
Number of implementations
Number of queries
Number of subinterfaces
Source lines of code
True comment ratio
Class Metrics
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
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 dependencies
Number of dependent classes
Number of inner classes
Number of interfaces implemented
Number of operations added
Number of operations inherited
Number of operations overridden
Number of queries
Number of statements
Number of subclasses
Source lines of code
True comment ratio
Weighted method complexity
Method Metrics
Comment lines of code
Comment ratio
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 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.2
-


20 new metrics added.
"Update and show differences" action added.
"Scroll to Source" and "Autoscroll to Source" actions added.
Improvements to display of histograms.
Much bug fixes 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

Tried downloading MR 0.3 from Plugin manager on a fresh install of 2126
but it doesn't install. Does MR somehow know I was going to use it for
ranking developers' output? ;)

Jon

0
Comment actions Permalink

Doh! What's the most important test to do before shipping software? The installer test. I skipped that one, and put a screwed-up zip on the plugin site. (Wierdly enough, it didn't complain.) Anyway, 0.3.1 is now up, and should install correctly. You may wish to clean up your plugin directory, as the 0.3 install left some crumbs behind.

--Dave Griffith

0
Comment actions Permalink

What about running these offline and generating an xml output.
I still need to send you my rendering stylesheet.

Jacques

0
Comment actions Permalink


Both XML output and off-line access are in plan, probably for 0.4 or 0.5. Actually, you can "output" to XML now, as the snapshot files that MR creates are simple XML, but that's certainly not the level of support I eventually intend. The bottleneck on export to XML/HTML isn't the logic (which is trivial) but rather figuring out how to have a Swing save dialog with a three-way file-type switch on it, as many Windows apps do. Any help on that would be greatly appreciated

--Dave Griffith

0
Comment actions Permalink

Dave Griffith wrote:

... figuring out how to have a Swing save dialog with a three-way file-type switch on it, as many Windows apps do. Any help on that would be greatly appreciated


Use the JFileChooser.addChoosableFileFilter() method to add filters for your
three different file types. After the user has selected the file to save to,
you can use the JFileChooser.getFileFilter() method to figure out which
filter was selected and save in the appropriate format. Example:

...
JFileChooser chooser = new JFileChooser();
MyFileFilter pdfFilter = new MyFileFilter(".pdf", "PDF Files");
MyFileFilter docFilter = new MyFileFilter(".doc", "DOC Files");
chooser.addChoosableFileFilter(pdfFilter);
chooser.addChoosableFileFilter(docFilter);
...
int option = chooser.showSaveDialog(...);
if (option == JFileChooser.APPROVE_OPTION) {
FileFilter selectedFilter = chooser.getFileFilter();
if (selectedFilter == pdfFilter) {
...
} else if (selectedFilter == docFilter) {
...
} else {
...
}
}
...

public class MyFileFilter extends FileFilter {
public String extension;
public String description;

public MyFileFilter(String extension, String description) {
this.extension = extension;
this.description = description;
}

public boolean accept(File f) {
return f.isDirectory() || f.getName().endsWith(extension);
}

public String getDescription() {
return description;
}
}


Hope that helps!

Vil.
--
Vilya Harvey
vilya.harvey@digitalsteps.com / digital steps /
(W) +44 (0)1483 469 480
(M) +44 (0)7816 678 457 http://www.digitalsteps.com/

0
Comment actions Permalink


Excellent. I had missed that section of the API completely.
Export to XML and HTML will thus be in 0.4, along with some misc UI improvements (table model, mostly), and it should happen pretty quickly. Jacques, if you would send me your HTML format, that would make things a bit easier.

Thanks.

--Dave Griffith

0

Please sign in to leave a comment.