Sha256: 4559322187a2acb9b117945a1c9d23114526e4346fd2707b443a58f1a53423e3

Contents?: true

Size: 533 Bytes

Versions: 2

Compression:

Stored size: 533 Bytes

Contents

module Overcommit::Hook::PreCommit
  # Runs `reek` against any modified Ruby files.
  #
  # @see https://github.com/troessner/reek
  class Reek < Base
    def run
      result = execute(command + applicable_files)
      return :pass if result.success?

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

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

    private

    def scrub_output(raw_output)
      raw_output.split("\n").grep(/^(.(?!warning))*$/)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
overcommit-0.27.0 lib/overcommit/hook/pre_commit/reek.rb
overcommit-0.26.0 lib/overcommit/hook/pre_commit/reek.rb