MetricsReloaded

Compatible with all products except MPS
09.05.2016
80 523
Automated code metrics for IntelliJ IDEA and IntelliJ Platform IDEs. Lines of Code and file count metrics for all languages supported by your IDE and many more metrics for Java.

Getting started

Select the menu item Help | Find Action... and search for Calculate Metrics.... Try the Lines of code metrics profile first, if you haven't used MetricsReloaded before.

Metrics can also be calculated from the command line for integration into build servers. Enter idea metrics -h for help. For this to work IntelliJ IDEA must not be running.

Download plugin

Version

Update date

Recent change notes

Metrics Reloaded 1.7. Change notes
- Results table now has speed search
- Fixed reading and writing of snapshot files (#32)
- Fixed dependency calculating and made it more efficient
- Fixed "Encapsulation ratio" (E_RAT) module metric
- Fixed reporting for "True comment ratio" (TCOM_RAT) interface metric
- Fixed Javadoc metrics reported for non-Java files (#8)
- Internal improvements & optimizations

General usage instructions

Select the menu item Analyze | Calculate Metrics...


Metrics can also be calculated from the command line for integration into build servers. Enter idea metrics -h for help. For this to work IntelliJ IDEA must not be running.

02.05.2013
I get an exception when IJ 12.1.2 starts up: com.sixrr.metrics.plugin.MetricsPluginImpl@10595ed java.lang.ExceptionInInitializerError at com.sixrr.metrics.ui.metricdisplay.MetricsToolWindowImpl.(MetricsToolWindowImpl.java:54) at com.sixrr.metrics.plugin.MetricsPluginImpl.projectOpened(MetricsPluginImpl.java:55) at com.intellij.openapi.project.impl.ProjectImpl.c(ProjectImpl.java:418) at com.intellij.openapi.project.impl.ProjectImpl.access$200(ProjectImpl.java:76) at com.intellij.openapi.project.impl.ProjectImpl$MyProjectManagerListener.projectOpened(ProjectImpl.java:454) at com.intellij.openapi.project.impl.ProjectManagerImpl$2.projectOpened(ProjectManagerImpl.java:155) at com.intellij.openapi.project.impl.ProjectManagerImpl.e(ProjectManagerImpl.java:1041) at com.intellij.openapi.project.impl.ProjectManagerImpl.openProject(ProjectManagerImpl.java:411) at com.intellij.openapi.project.impl.ProjectManagerImpl.loadAndOpenProject(ProjectManagerImpl.java:502) at com.intellij.ide.impl.ProjectUtil.openProject(ProjectUtil.java:178) at com.intellij.ide.RecentProjectsManager.doOpenProject(RecentProjectsManager.java:46) at com.intellij.ide.RecentProjectsManagerBase$MyAppLifecycleListener.appStarting(RecentProjectsManagerBase.java:321) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:120) at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:228) at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:219) at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:209) at com.intellij.util.messages.impl.MessageBusImpl.access$000(MessageBusImpl.java:43) at com.intellij.util.messages.impl.MessageBusImpl$1.invoke(MessageBusImpl.java:131) at $Proxy35.appStarting(Unknown Source) at com.intellij.idea.IdeaApplication.d(IdeaApplication.java:349) at com.intellij.idea.IdeaApplication.access$500(IdeaApplication.java:57) at com.intellij.idea.IdeaApplication$IdeStarter$2.run(IdeaApplication.java:316) at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:343) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:682) at java.awt.EventQueue$3.run(EventQueue.java:680) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) at java.awt.EventQueue.dispatchEvent(EventQueue.java:691) at com.intellij.ide.IdeEventQueue.d(IdeEventQueue.java:700) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:525) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:348) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) Caused by: java.lang.NullPointerException at javax.swing.ImageIcon.(ImageIcon.java:205) at com.sixrr.metrics.utils.IconHelper.getIcon(IconHelper.java:32) at com.sixrr.metrics.ui.metricdisplay.UpdateMetricsViewAction.(UpdateMetricsViewAction.java:33) ... 44 more
21.11.2011
Class not found exception when running under IntelliJ 9.0.4:


com/intellij/ui/table/JBTable: com/intellij/ui/table/JBTable
java.lang.NoClassDefFoundError: com/intellij/ui/table/JBTable
at com.sixrr.metrics.ui.metricdisplay.MetricsToolWindowImpl.(MetricsToolWindowImpl.java:67)
at com.sixrr.metrics.plugin.MetricsPluginImpl.projectOpened(MetricsPluginImpl.java:55)
at com.intellij.openapi.project.impl.ProjectImpl.c(ProjectImpl.java:310)
at com.intellij.openapi.project.impl.ProjectImpl.access$200(ProjectImpl.java:66)
at com.intellij.openapi.project.impl.ProjectImpl$MyProjectManagerListener.projectOpened(ProjectImpl.java:345)
at com.intellij.openapi.project.impl.ProjectManagerImpl$2.projectOpened(ProjectManagerImpl.java:137)
at com.intellij.openapi.project.impl.ProjectManagerImpl.d(ProjectManagerImpl.java:925)
at com.intellij.openapi.project.impl.ProjectManagerImpl.openProject(ProjectManagerImpl.java:368)
at com.intellij.openapi.project.impl.ProjectManagerImpl.loadAndOpenProject(ProjectManagerImpl.java:420)
at com.intellij.openapi.project.impl.ProjectManagerImpl.loadAndOpenProject(ProjectManagerImpl.java:403)
at com.intellij.ide.impl.ProjectUtil.openProject(ProjectUtil.java:157)
at com.intellij.ide.RecentProjectsManager.doOpenProject(RecentProjectsManager.java:48)
at com.intellij.ide.RecentProjectsManagerBase$ReopenProjectAction.actionPerformed(RecentProjectsManagerBase.java:229)
at com.intellij.ui.popup.PopupFactoryImpl$ActionPopupStep$1.run(PopupFactoryImpl.java:482)
at com.intellij.openapi.wm.impl.FocusManagerImpl.c(FocusManagerImpl.java:407)
at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:347)
at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:937)
at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:145)
at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:253)
at com.intellij.ui.popup.PopupFactoryImpl$2.dispose(PopupFactoryImpl.java:169)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:37)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:35)
at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:126)
at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:108)
at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:154)
at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:108)
at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:136)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:94)
at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:902)
at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:145)
at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:253)
at com.intellij.ui.popup.PopupFactoryImpl$2.dispose(PopupFactoryImpl.java:169)
at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:242)
at com.intellij.ui.popup.list.ListPopupImpl.a(ListPopupImpl.java:337)
at com.intellij.ui.popup.list.ListPopupImpl.a(ListPopupImpl.java:308)
at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:280)
at com.intellij.ui.popup.list.ListPopupImpl$MyMouseListener.mousePressed(ListPopupImpl.java:383)
at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:263)
at java.awt.Component.processMouseEvent(Component.java:6260)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3255)
at java.awt.Component.processEvent(Component.java:6028)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4235)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2475)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at com.intellij.ide.IdeEventQueue.f(IdeEventQueue.java:627)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:504)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:405)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:369)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassNotFoundException: com.intellij.ui.table.JBTable
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:70)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
... 62 more
22.09.2011
Is this project documented? I don't know what a good fraction of the output means. Thank you. -- matt
14.09.2011
Hi,

This looks pretty useful but can someone please tell me how to run it from the command line?

Or at least direct me to any documentation?

Thanks.
04.08.2011
The complexity metric for:

boolean checkIt() {
return foo() && bar();
}

should be 2, not 1.
Anonymous
30.03.2011
Crashes on IDEA 9.0.3
See other comments for exception stack traces
18.03.2011
Doesn't work:

Error during dispatching of java.awt.event.MouseEvent[MOUSE_RELEASED,(83,217),absolute(628,618),button=1,modifiers=Button1,clickCount=1] on ###overrideRedirect###
java.lang.NullPointerException
at com.sixrr.metrics.plugin.ProjectMetricsAction.analyze(ProjectMetricsAction.java:68)
at com.intellij.analysis.BaseAnalysisAction.actionPerformed(BaseAnalysisAction.java:107)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:218)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:81)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1223)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1264)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
Anonymous
11.03.2011
NoClassDefFoundError for me....

com/intellij/ui/table/JBTable: com/intellij/ui/table/JBTable
java.lang.NoClassDefFoundError: com/intellij/ui/table/JBTable
at com.sixrr.metrics.ui.metricdisplay.MetricsToolWindowImpl.(MetricsToolWindowImpl.java:67)
at com.sixrr.metrics.plugin.MetricsPluginImpl.projectOpened(MetricsPluginImpl.java:55)
at com.intellij.openapi.project.impl.ProjectImpl.c(ProjectImpl.java:310)
at com.intellij.openapi.project.impl.ProjectImpl.access$200(ProjectImpl.java:66)
at com.intellij.openapi.project.impl.ProjectImpl$MyProjectManagerListener.projectOpened(ProjectImpl.java:345)
at com.intellij.openapi.project.impl.ProjectManagerImpl$2.projectOpened(ProjectManagerImpl.java:137)
at com.intellij.openapi.project.impl.ProjectManagerImpl.d(ProjectManagerImpl.java:925)
at com.intellij.openapi.project.impl.ProjectManagerImpl.openProject(ProjectManagerImpl.java:368)
at com.intellij.openapi.project.impl.ProjectManagerImpl.loadAndOpenProject(ProjectManagerImpl.java:420)
at com.intellij.openapi.project.impl.ProjectManagerImpl.loadAndOpenProject(ProjectManagerImpl.java:403)
at com.intellij.ide.impl.ProjectUtil.openProject(ProjectUtil.java:157)
at com.intellij.ide.RecentProjectsManager.doOpenProject(RecentProjectsManager.java:48)
at com.intellij.ide.RecentProjectsManagerBase$ReopenProjectAction.actionPerformed(RecentProjectsManagerBase.java:229)
at com.intellij.ui.popup.PopupFactoryImpl$ActionPopupStep$1.run(PopupFactoryImpl.java:482)
at com.intellij.openapi.wm.impl.FocusManagerImpl.c(FocusManagerImpl.java:387)
at com.intellij.openapi.wm.impl.FocusManagerImpl.access$200(FocusManagerImpl.java:47)
at com.intellij.openapi.wm.impl.FocusManagerImpl$1.runEdt(FocusManagerImpl.java:76)
at com.intellij.openapi.util.EdtRunnable$1.run(EdtRunnable.java:25)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at com.intellij.ide.IdeEventQueue.f(IdeEventQueue.java:610)
at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:500)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:368)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.ClassNotFoundException: com.intellij.ui.table.JBTable
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:70)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:316)
... 29 more
25.01.2011
Thanks for the update.
25.01.2011
I have just uploaded a new version compatible with IntelliJ IDEA 9 & 10. Let me know how you like it.
Anonymous
22.01.2011
Doesn't work on 9 or 10, at all.
03.12.2010
doesn't work for me on Idea v.9
Anonymous
21.07.2010
Here's a version that should work in Diana/8.x and Maia/9.x.

Once installed, the menu is Analyze -> Calculate Metrics...

http://dl.dropbox.com/u/2107675/MetricsReloaded/MetricsReloaded_0.9.2.2.zip
Anonymous
24.05.2010
Doesnt seem to work for intellij 9.0 ?!?

/K
Anonymous
24.05.2010
It's sad that the plugin doesn't describe what versions of idea it works with.

It's sad that it no longer works with 9.

It's sad that jetbrains don't take this plugin over and make it work.
Please  sign in  to leave a comment.