class Overcommit::Hook::PreCommit::Reek

Runs ‘reek` against any modified Ruby files.

@see github.com/troessner/reek

Public Instance Methods

run() click to toggle source
# File lib/overcommit/hook/pre_commit/reek.rb, line 8
def run
  result = execute(command, args: applicable_files)
  return :pass if result.success?

  output = scrub_output(result.stdout + result.stderr)

  extract_messages(
    output,
    /^\s*(?<file>(?:\w:)?[^:]+):(?<line>\d+):/,
  )
end

Private Instance Methods

scrub_output(raw_output) click to toggle source
# File lib/overcommit/hook/pre_commit/reek.rb, line 22
def scrub_output(raw_output)
  raw_output.split("\n").grep(/^(.(?!warning))*$/)
end