Ruby Static Analysis Tools Roundup: metric_fu, Simian, Saikuro and More

| by Sebastien Auvray Follow 0 Followers on Sep 12, 2009. Estimated reading time: 1 minute |

Code quality is one of the bricks of software quality. While tools for the mainstream languages such as Java and C++ have reached a certain maturity, tools for Ruby are still growing. And they might be needed more and more as Ruby's usage spreads from early adopters to the early majority, and SLOC (Source Lines Of Code) continues to rise. Automatic tools can be used to detect several types of problems including inconsistent style, long methods and repeated code.

Steve Hayes gave a presentation entitled "Code Quality For Java And Ruby" at the Agile2009 Conference held in Chicago, which gives InfoQ a good opportunity to review the tools available in the Ruby world:

  • Roodi (Ruby Object Oriented Design Inferometer) - this parses your Ruby code and warns you about design issues from the list you configured, ie: Class line count check, for loop check, parameter number check, cyclomatic checks and 10 other checks
  • Reek - similar in concept to Roodi
  • Saikuro - designed to check cyclomatic complexity
  • Flog - created by Ryan Davis, this computes a score of your code: the higher the score is, the worse your code is. ABC metrics (Assignments, Branches and Calls) are taken into account to compute the score
  • Simian - a similarity analyser, this can be used for duplication identification (you need a $99 license for commercial use)
  • Flay - this is another free tool from Ryan Davis that finds structural similarities in code

Using all these tools can quickly become a pain, that's when metric_fu comes to the rescue. It includes all the mentioned tools (except Simian), and can easily generate a report about your application. It integrates easily with Rails and generates graphs over time.

Graph from Jakes Scruggs

You can follow Assaf Arkin's Guide to setting up Hudson for a Rails project with metric_fu support.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Railscast #166 on metric_fu by Sean Miller

Railscast #166 had Ryan Bates talking about metric_fu:

Excellent by Marco Otte-Witte

You might also be interested in excellent, a gem that combines many of the checks the above analysers provide and adds some checks that are specific to Ruby on Rails applications:

Re: Excellent by Sebastien Auvray

Hi Marco & Seam,
Thank you both for your links.
Marco, I also found out afterward this one for Rails:

duplicate lines report by Jean-Michel Garnier

Regarding dupplication, I wrote a gem which generate reports (HTML, Textmate, Netbeans, etc …) of identical duplicate lines, backed by java tool Simian.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

4 Discuss

Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you