Sha256: 213ef5754b7aa36b2840d57e50dd28282701a252676f59d6fc4ff19f67fc43fb

Contents?: true

Size: 518 Bytes

Versions: 3

Compression:

Stored size: 518 Bytes

Contents

module Overcommit::Hook::PreCommit
  # Runs `reek` against any modified Ruby files.
  class Reek < Base
    def run
      result = execute(%W[#{executable} --single-line --no-color] + applicable_files)
      return :pass if result.success?

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

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

    private

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

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
jawshooah-overcommit-0.22.0 lib/overcommit/hook/pre_commit/reek.rb
overcommit-0.21.0 lib/overcommit/hook/pre_commit/reek.rb
overcommit-0.20.0 lib/overcommit/hook/pre_commit/reek.rb