Class: Danger::DangerWCC::Reek

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/wcc/reek.rb

Instance Method Summary collapse

Methods included from Utils

#diff_strings, #each_addition_in_diff, #each_file_in_diff, #find_in_diff, #format_links_as_markdown, #issue, #logger, #parsed_diffs, #plugin, #run, #run_and_diff, #with_revision

Constructor Details

#initialize(plugin, options = {}) ⇒ Reek

Returns a new instance of Reek.



9
10
11
12
# File 'lib/wcc/reek.rb', line 9

def initialize(plugin, options = {})
  @plugin = plugin
  @options = options
end

Instance Method Details

#performObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/wcc/reek.rb', line 14

def perform
  # get the diff of new reek issues
  diff = run_reek_diff

  # run reek again to get line numbers
  reek_lines = run 'bundle exec reek --single-line --no-progress --no-color'
  reek_lines = reek_lines.lines

  each_addition_in_diff(diff) do |line|
    add_reek_warning(line, reek_lines[line.line_number.right - 1])
  end
end