2

I have been asked to measure a 50K+ line Java project for it's CC, Cyclomatic Complexity, per unit. In Java, a unit would be a method.

All the tools I have found measure the overall CC of the project. Is there any tool available for the purpose of measuring the CC per unit, and reporting the CC with the lines of code used in that method?

It's not a strict requirement, but I'd prefer to use it without an IDE. Platform can be either OSX or NIX.

  • You may consider to not measure it at all. I used ConQAT in my last company which is Java-based, so potentially runs on Linux, but their strong belief is that it's not a good metric and therefore is not supported – Thomas Weller Jan 10 '16 at 16:00
1

You could also take a look at OovAide, formerly oovcde, which is a Free, Open Source, standalone C++ or Java analysis IDE for Windows or Linux.

It offers the following features:

  • Complexity measurements, McCabe & its own, of source code for each method of a class PLUS
  • Automatically generated class, sequence and component diagrams
  • Diagrams show more relations than UML
  • Automated dependency parsing of C++ source code (based on CLang)
  • Quick navigation between drawings and code
  • Multi-tasking build system
  • Syntax highlighting (based on CLang)
  • GDB debugging
  • Drawings can be saved as SVG
  • Code test coverage
  • Duplicate code detection
  • Dead code detection
  • Static analysis of method and attribute usage

enter image description here

0

MetricsReloaded does exactly what I need. It's a plugin for IntelliJ IDEA.

After restarting IntelliJ, you can measure the Complexity per Unit under Analyze -> Calculate Metrics. Under Metrics profile you can select your own criteria by clicking the triple dots besides the dropdown selection.

Complexity per Unit in MetricsReloaded

0

The standalone Java Metrics Tool from my company, Semantic Designs can do this.

It provides a variety of metrics at method level, including cyclomatic complexity, as well as roll-up summaries for every "container" above the method (class, file, package, subdirectory).

A text report is shown here. Generally it produces an XML Report that can be used with XSLT to provide any format you desire; HTML is pretty easy.

It is Windows native, but runs just fine under Wine on Linux, even as a scriptable command.

Since this is my company, dont take this as a recommendation. I'm just documenting its existence.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.