public
Description: Code smell detector for Ruby
Homepage: http://wiki.github.com/kevinrutherford/reek
Clone URL: git://github.com/kevinrutherford/reek.git
reek /
name age message
file .gitignore Sun Sep 20 12:51:40 -0700 2009 Minor fixes to get metric_fu working on Reek it... [kevinrutherford]
file History.txt Thu Nov 19 13:54:34 -0800 2009 Release 1.2.5 [kevinrutherford]
file License.txt Thu Jul 09 12:53:06 -0700 2009 Added missing licence file [kevinrutherford]
file Manifest.txt Thu Nov 19 13:54:34 -0800 2009 Release 1.2.5 [kevinrutherford]
file README.rdoc Mon Sep 21 13:25:29 -0700 2009 Minor tweaks for 1.9 compatibility etc [kevinrutherford]
file Rakefile Mon Oct 12 06:47:36 -0700 2009 First feature for RakeTask [kevinrutherford]
directory bin/ Fri Jul 24 12:34:30 -0700 2009 Reduced dependency on ParseTree in the tests [kevinrutherford]
directory config/ Sun Nov 01 12:23:15 -0800 2009 Removed mor duplication [kevinrutherford]
directory features/ Mon Nov 16 09:09:11 -0800 2009 Extended ControlCouple to check for boolean params [kevinrutherford]
directory lib/ Thu Nov 19 13:54:34 -0800 2009 Release 1.2.5 [kevinrutherford]
directory quality/ Tue Nov 10 07:37:51 -0800 2009 Replaced the hash of exit statuses [kevinrutherford]
file reek.gemspec Thu Nov 19 13:54:34 -0800 2009 Release 1.2.5 [kevinrutherford]
directory spec/ Thu Nov 19 13:50:04 -0800 2009 Reports and ignores ruby_parser errors [kevinrutherford]
directory tasks/ Mon Oct 12 08:49:18 -0700 2009 Preparing to develop reek without attributes [kevinrutherford]
directory website/ Mon Feb 09 12:17:26 -0800 2009 Added a new website for Rubyforge to redirect t... [kevinrutherford]
README.rdoc

Reek — code smell detection for Ruby

Reek is a tool that examines Ruby classes, modules and methods and reports any code smells it finds. Install it like this:

  $ gem install reek

and run it like this:

  $ reek [options] [dir_or_source_file]*

For a full list of command-line options see the Reek wiki or run

  $ reek --help

Example

Imagine a source file csv_writer.rb containing:

  class CsvWriter
    def write_line(fields)
      if (fields.length == 0)
        puts
      else
        write_field(fields[0])
        1.upto(fields.length-1) do |i|
          print ","
          write_field(fields[i])
        end
        puts
      end
    end

    #...
  end

Reek will report the following code smells in this file:

  $ reek csv_writer.rb
  CsvWriter#write_line calls fields.length multiple times (Duplication)
  CsvWriter#write_line has approx 6 statements (Long Method)
  CsvWriter#write_line/block has the variable name 'i' (Uncommunicative Name)

Features

Reek currently includes checks for some aspects of the following smells:

…and more. See the Reek wiki for up to date details of exactly what Reek will check in your code.

Tool Integration

Reek integrates with many of your favourite tools:

  • Use Reek::RakeTask to easily add Reek to your Rakefile
  • Use Reek::Spec to add the should_not reek custom matcher to your Rspec examples
  • Reek is fully compliant with Ruby 1.8.6, 1.8.7 and 1.9.1

Dependencies

Reek makes use of the following other gems:

  • ruby_parser
  • sexp_processor
  • ruby2ruby

Learn More

Find out more about Reek from any of the following sources: