Sha256: 4430a9a6c09b344ca979247354f7a37e3abd71e9d5d9cf12cb2b5e9bd96f73e7

Contents?: true

Size: 508 Bytes

Versions: 10

Compression:

Stored size: 508 Bytes

Contents

# frozen_string_literal: true

module Overcommit::Hook::Shared
  # Shared code used by all Pronto hooks. Runs pronto linter.
  module Pronto
    MESSAGE_TYPE_CATEGORIZER = lambda do |type|
      type.include?('E') ? :error : :warning
    end

    def run
      result = execute(command)
      return :pass if result.success?

      extract_messages(
        result.stdout.split("\n"),
        /^(?<file>(?:\w:)?[^:]+):(?<line>\d+) (?<type>[^ ]+)/,
        MESSAGE_TYPE_CATEGORIZER,
      )
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
overcommit-0.58.0 lib/overcommit/hook/shared/pronto.rb
overcommit-0.57.0 lib/overcommit/hook/shared/pronto.rb
overcommit-0.56.0 lib/overcommit/hook/shared/pronto.rb
overcommit-0.55.0 lib/overcommit/hook/shared/pronto.rb
overcommit-0.54.1 lib/overcommit/hook/shared/pronto.rb
overcommit-0.54.0 lib/overcommit/hook/shared/pronto.rb
overcommit-jeygeethanmedia-0.53.1.2 lib/overcommit/hook/shared/pronto.rb
overcommit-jeygeethanmedia-0.53.1.1 lib/overcommit/hook/shared/pronto.rb
overcommit-jeygeethanmedia-0.53.1 lib/overcommit/hook/shared/pronto.rb
overcommit-0.53.0 lib/overcommit/hook/shared/pronto.rb