Qafoo GmbH - passion for software quality

Help you and your team benefit from new perspectives on cutting-edge quality engineering techniques and tools through the Qafoo team weblog.

By Kore Nordmann, first published at Mon, 05 Nov 2012 08:50:23 +0100

Download our free e-book "Crafting Quality Software" with a selection of the finest blog posts as PDF or EPub.

Crafting Quality Software

You can also buy a printed version of the book on Amazon or on epubli.

Code Review Tool

We, at Qafoo, do Code Reviews quite often together with our customers. This often focusses on dicussing metrics, browsing the associated code and discussing solutions for the issues found. We started using a bunch of shell scripts for that, like everyone else, but at some point we came up with a webinterface to do this in a more comfortable way. Now we want to share this tool with you.

The tool currently focuses on our use cases and probably will continue to do so. This involves getting an overview on the customers source code. There are several metrics, like Code Rank, Weighted Method per Class and alike which give you an overview on that. We found "tag clouds" and tables the best view to browse them. Of course all classes are clickable and directly lead to the related source code view:

PDepend Code Rank classes tag cloudPDepend Code Rank classes tag cloud

Additionally we often want to know about especially complex parts in the application, and the distribution of complexity. For the first also Method based tag clouds for metrics like Cyclomatic Complexity and NPath Complexity exist. For the distribution we also generate charts to get a quick overview:

Want to train your skills in using software metrics, continuous integration and automated testing? Get an individual Qafoo expert training for your team!

Cyclomatic Complexity distribution chartCyclomatic Complexity distribution chart

On top of those simple metrics a combination of metrics often makes sense especially on class level. For this we included a metrics "calculator" which lists the results of formulas based on class metric to find out more sophisticated and task related issues in software:

PDepend metric calculatorPDepend metric calculator

Source Code Browser

All mentions of classes reference the respective files in the source code browser. The source code browser also contains clickable annotations, so you can directly see if some analyzer complained about a certain class, method or line of code.

Basic source code browserBasic source code browser

You can of course also get a list of all annotations of the currently selected file:

Source file annotation listSource file annotation list

Or you can click through the class dependencies, based on usage or inheritance connections:

Class dependency listClass dependency list

Other Tools

It should be fairly simple to include other (custom) analyzers in this tool. By default there is also something which draws simplified class diagrams, lists issues discovered by PHPMD and the PHP Copy Paste Detector.

Class diagram extractClass diagram extract

The software has been licensed under AGPLv3 and is available on Github. Please keep in mind that we develop this software mainly for internal use, so things might change or break. We still want to share this little gem with you. Feel free to issue pull requests, fork it or do whatever you like with it. More screenshots can also be found on github.

For an installation guide checkout the README.rst. We hope it works for you as well, as it does for us.

Download our free e-book "Crafting Quality Software" with a selection of the finest blog posts as PDF or EPub.

Crafting Quality Software

You can also buy a printed version of the book on Amazon or on epubli.

Get Technical Insights With Our Newsletter

Stay up to date with regular new technological insights by subscribing to our newsletter. We will send you articles to improve your developments skills.


  • gggeek on Mon, 05 Nov 2012 10:33:05 +0100

    Very interesting!
    Looking forward to implement this as QA step in the ezextensionbuilder project.
    One question: is ant only needed to download the tool, or is it also needed to setup or execute the code analysis?

  • Kore on Mon, 05 Nov 2012 11:13:36 +0100

    @gggeek: ant is required to set the tool up. You can go without this by applying the MySQL-Schema manually and install the composer dependencies (I guess).

    After the initial installation ant will also provide you with the means to keep the tool up-to-date (migrations) and to verify that the tool itself still works.

    To execute the tool itself after successfull installation ant is not required.

  • Johann-Peter Hartmann on Mon, 05 Nov 2012 16:45:12 +0100

    Nice, thanks for sharing!
    - johann

  • Thomas Koch on Mon, 05 Nov 2012 17:46:36 +0100

    I thought you were talking about a code review tool like Gerrit (which I'm currently packaging for Debian) or reviewboard. Would code analysis/inspection tool describe it better?

  • Kore on Mon, 05 Nov 2012 21:44:15 +0100

    @Thomas Koch: Names have different meanings for different people, and names are just names. We *use* this tool for code reviews, so the name is appropriate to us. Feel free to tag it differently in your brain ;)