reek, a code smells detector for ruby

Posted on September 23, 2008

26


To complement the imminent (ie. sometime next year) publication of the Refactoring in Ruby I’ve been working on a little software tool called ‘reek’. Reek scans ruby code — either source files or in-memory Class objects — looking for some of the code smells discussed in the book. Right now it can detect (certain forms of):

  • Long Method
  • Large Class
  • Feature Envy
  • Uncommunicative Name
  • Long Parameter List
  • Utility Function
  • Nested Iterators

As time goes by I’ll be adding checks for more smells, and I hope to make the current checks a bit more sophisticated. But in the agile spirit of going ugly early, the current very early version is available for you to experiment with. To get the tool:

gem install reek

To run it:

reek file1.rb file2.rb ...

If you try it, please let me know what you think and what you’d like the next version to do!

You can browse the reek project’s code repository at http://github.com/kevinrutherford/reek/tree/master or http://rubyforge.org/projects/reek/, both of which are clones of the same Git repository.

Other Ruby tools operating in this same space include Marty Andrews’ Roodi, and flay and flog from the seattle.rb folks. All of these tools have been made possible by the excellent ParseTree gem from the amazingly productive folks at seattle.rb. Looks like Ruby code quality is a hot topic right now, which I think is great news.

About these ads
Posted in: refactoring, ruby