public
Description: Code smell detector for Ruby
Home | Edit | New

Rake Task

The Reek gem provides a Rake task that runs reek on a set of source files. For example, if you include the following in your Rakefile:

require 'reek/adapters/rake_task'

Reek::RakeTask.new do |t|
  t.fail_on_error = false
end

This will create a task that can be run with commands such as:

rake reek                                # checks for smells in all files lib/**/*.rb
rake reek REEK_SRC=just_one_file.rb      # checks a single source file
rake reek REEK_OPTS=-s                   # sorts the report by smell

The Rake task can be configured by setting its attributes, as follows:

Attribute Value
name The name by which this rake task will be invoked; defaults to “reek”.
libs An optional array of directories to be added to $LOAD_PATH before running reek. Defaults to the absolute path to the Reek gem’s lib directory
source_files The glob pattern to match source files. Setting the REEK_SRC environment variable overrides this attribute. Defaults to lib/**/*.rb.
reek_opts A string containing commandline options to be passed to Reek. Setting the REEK_OPTS environment variable overrides this attribute. Defaults to the empty string.
ruby_opts An array of commandline options to pass to ruby. Defaults to [].
fail_on_error Whether or not to fail Rake when an error occurs (typically when smells are found). Defaults to true.
verbose Use verbose output. If this is set to true, the task will print the reek command-line to stdout. Defaults to false.
Last edited by kevinrutherford, Sun Sep 13 13:46:22 -0700 2009
Home | Edit | New
Versions: