BT

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

by Sebastien Auvray on Sep 12, 2009 |

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.

Hello stranger!

You need to Register an InfoQ account or 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: railscasts.com/episodes/166-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:

simplabs.github.com/excellent/

Re: Excellent by Sebastien Auvray

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

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.

wiki.github.com/garnierjm/dont_repeat_yourself

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

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT