Sha256: 22fb2c5aeb34f9fe24f9e10484b92bd6885305f5f1dd6b4af0d6685cca72ab55

Contents?: true

Size: 490 Bytes

Versions: 3

Compression:

Stored size: 490 Bytes

Contents

# frozen_string_literal: true

module Overcommit::Hook::PreCommit
  # Runs `erblint` against any modified ERB files.
  #
  # @see https://github.com/Shopify/erb-lint
  class ErbLint < Base
    MESSAGE_REGEX = /(?<message>.+)\nIn file: (?<file>.+):(?<line>\d+)/.freeze

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

      extract_messages(
        result.stdout.split("\n\n")[1..],
        MESSAGE_REGEX
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
overcommit-0.64.1 lib/overcommit/hook/pre_commit/erb_lint.rb
overcommit-0.64.0 lib/overcommit/hook/pre_commit/erb_lint.rb
overcommit-0.63.0 lib/overcommit/hook/pre_commit/erb_lint.rb