Class: RuboCop::RakeTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/rubocop/rake_task.rb

Overview

Provides a custom rake task.

require ‘rubocop/rake_task’ RuboCop::RakeTask.new

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &task_block) ⇒ RakeTask

Returns a new instance of RakeTask.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rubocop/rake_task.rb', line 21

def initialize(*args, &task_block)
  setup_ivars(args)

  desc 'Run RuboCop' unless ::Rake.application.last_description

  task(name, *args) do |_, task_args|
    RakeFileUtils.send(:verbose, verbose) do
      yield(*[self, task_args].slice(0, task_block.arity)) if block_given?
      run_main_task(verbose)
    end
  end

  setup_subtasks(name, *args, &task_block)
end

Instance Attribute Details

#fail_on_errorObject

Returns the value of attribute fail_on_error.



15
16
17
# File 'lib/rubocop/rake_task.rb', line 15

def fail_on_error
  @fail_on_error
end

#formattersObject

Returns the value of attribute formatters.



17
18
19
# File 'lib/rubocop/rake_task.rb', line 17

def formatters
  @formatters
end

#nameObject

Returns the value of attribute name.



13
14
15
# File 'lib/rubocop/rake_task.rb', line 13

def name
  @name
end

#optionsObject

Returns the value of attribute options.



19
20
21
# File 'lib/rubocop/rake_task.rb', line 19

def options
  @options
end

#patternsObject

Returns the value of attribute patterns.



16
17
18
# File 'lib/rubocop/rake_task.rb', line 16

def patterns
  @patterns
end

#requiresObject

Returns the value of attribute requires.



18
19
20
# File 'lib/rubocop/rake_task.rb', line 18

def requires
  @requires
end

#verboseObject

Returns the value of attribute verbose.



14
15
16
# File 'lib/rubocop/rake_task.rb', line 14

def verbose
  @verbose
end

Instance Method Details

#run_main_task(verbose) ⇒ Object



36
37
38
# File 'lib/rubocop/rake_task.rb', line 36

def run_main_task(verbose)
  run_cli(verbose, full_options)
end