Class: Reek::RakeTask
- Defined in:
- lib/reek/adapters/rake_task.rb
Overview
A Rake task that runs reek on a set of source files.
Example:
Reek::RakeTask.new do |t|
t.fail_on_error = false
end
This will create a task that can be run with:
rake reek
Examples:
rake reek # checks 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
Instance Attribute Summary collapse
-
#fail_on_error ⇒ Object
Whether or not to fail Rake when an error occurs (typically when smells are found).
-
#libs ⇒ Object
Array of directories to be added to $LOAD_PATH before running reek.
-
#name ⇒ Object
Name of reek task.
-
#reek_opts ⇒ Object
String containing commandline options to be passed to Reek.
-
#ruby_opts ⇒ Object
Array of commandline options to pass to ruby.
-
#source_files ⇒ Object
Glob pattern to match source files.
-
#verbose ⇒ Object
Use verbose output.
Instance Method Summary collapse
-
#initialize(name = :reek) {|_self| ... } ⇒ RakeTask
constructor
Defines a new task, using the name
name
.
Constructor Details
#initialize(name = :reek) {|_self| ... } ⇒ RakeTask
Defines a new task, using the name name
.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/reek/adapters/rake_task.rb', line 60 def initialize(name = :reek) @name = name @libs = [File.(File.dirname(__FILE__) + '/../../../lib')] @source_files = nil @ruby_opts = [] @reek_opts = '' @fail_on_error = true @sort = nil yield self if block_given? @source_files ||= 'lib/**/*.rb' define end |
Instance Attribute Details
#fail_on_error ⇒ Object
Whether or not to fail Rake when an error occurs (typically when smells are found). Defaults to true.
53 54 55 |
# File 'lib/reek/adapters/rake_task.rb', line 53 def fail_on_error @fail_on_error end |
#libs ⇒ Object
Array of directories to be added to $LOAD_PATH before running reek. Defaults to [‘<the absolute path to reek’s lib directory>‘]
36 37 38 |
# File 'lib/reek/adapters/rake_task.rb', line 36 def libs @libs end |
#name ⇒ Object
Name of reek task. Defaults to :reek.
32 33 34 |
# File 'lib/reek/adapters/rake_task.rb', line 32 def name @name end |
#reek_opts ⇒ Object
String containing commandline options to be passed to Reek. Setting the REEK_OPTS environment variable overrides this value. Defaults to ”.
46 47 48 |
# File 'lib/reek/adapters/rake_task.rb', line 46 def reek_opts @reek_opts end |
#ruby_opts ⇒ Object
Array of commandline options to pass to ruby. Defaults to [].
49 50 51 |
# File 'lib/reek/adapters/rake_task.rb', line 49 def ruby_opts @ruby_opts end |
#source_files ⇒ Object
Glob pattern to match source files. Setting the REEK_SRC environment variable overrides this. Defaults to ‘lib/*/.rb’.
41 42 43 |
# File 'lib/reek/adapters/rake_task.rb', line 41 def source_files @source_files end |
#verbose ⇒ Object
Use verbose output. If this is set to true, the task will print the reek command to stdout. Defaults to false.
57 58 59 |
# File 'lib/reek/adapters/rake_task.rb', line 57 def verbose @verbose end |