Sha256: c32d074ccbbfe8dd92f404b74f2fbb205e5eb940e92645637ebcdbfde9a7546b

Contents?: true

Size: 577 Bytes

Versions: 28

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

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, 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

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

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
overcommit-0.52.0 lib/overcommit/hook/pre_commit/reek.rb
overcommit-0.51.0 lib/overcommit/hook/pre_commit/reek.rb
overcommit-0.50.0 lib/overcommit/hook/pre_commit/reek.rb
overcommit-0.49.1 lib/overcommit/hook/pre_commit/reek.rb
overcommit-0.49.0 lib/overcommit/hook/pre_commit/reek.rb
overcommit-0.48.1 lib/overcommit/hook/pre_commit/reek.rb
overcommit-0.48.0 lib/overcommit/hook/pre_commit/reek.rb
overcommit-0.47.0 lib/overcommit/hook/pre_commit/reek.rb