InfoQ

InfoQ

News

My Bookmarks

Login or Register to enable bookmarks for unlimited time.

The content has been bookmarked!

There was an error bookmarking this content! Please retry.

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

Posted by Sebastien Auvray on Sep 12, 2009

Sections
Process & Practices,
Architecture & Design,
Development
Topics
Ruby ,
Agile ,
Code Analysis ,
Agile Techniques

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.

Related Sponsor

In today’s hyper-competitive world, later may be too late to adopt Agile development and this Roadmap for Success will help you get started. Download "Agile Development: A Manager's Roadmap for Success" now!

Railscast #166 on metric_fu by Sean Miller Posted
Excellent by Marco Otte-Witte Posted
Re: Excellent by Sebastien Auvray Posted
duplicate lines report by Jean-Michel Garnier Posted
  1. Back to top

    Railscast #166 on metric_fu

    by Sean Miller

    Railscast #166 had Ryan Bates talking about metric_fu: railscasts.com/episodes/166-metric-fu

  2. Back to top

    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/

  3. Back to top

    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

  4. Back to top

    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

Educational Content

Jesper Boeg on Priming Kanban

In this interview, Jesper Boeg, author of the new InfoQ book – Priming Kanban, discusses the keys to using Kanban effectively, and how to get started if you are currently using other approaches.

New-age Transactional Systems - Not Your Grandpa's OLTP

John Hugg discusses high volume transaction processing applications with high and low frequency profiles, and how VoltDB can be used for that purpose.

Cool Code

Kevlin Henney examines code samples to see what can be learned from them starting from the premise that one won’t write great code unless he knows how to read it.

Collaboration: At the Extremities of Extreme

Jason Ayers share the observations he made watching a team of developers collaborating in real time on the same code base, pushing XP, pair programming and continuous integration to their extremes.

Yesod Web Framework

Michael Snoyman presents Yesod, a web framework written in Haskell and containing a web server, templating, ORM, libraries (templating, gravatar, etc.).

Transactions without Transactions

Richard Kreuter and Kyle Banker on how to avoid classical RDBMS transactional systems by using compensation mechanisms, transactional messaging or transactional procedures.

Attila Szegedi on JVM and GC Performance Tuning at Twitter

Attila Szegedi talks about performance tuning Java and Scala programs at Twitter: how to approach GC problems, the importance of asynchronous I/O, when to use MySQL/Cassandra/Redis, and much more.

10 tips on how to prevent business value risk

One category of risk that project teams need to ensure they address is business value failure – delivering a product that fails to provide value for the business investor.