Sha256: bd880fc9c8ac43fa526d7ef80b71da2d598d1588783fa971f6bac4a03b99ca7a

Contents?: true

Size: 560 Bytes

Versions: 28

Compression:

Stored size: 560 Bytes

Contents

module Overcommit::Hook::PreCommit
  # Runs `haml-lint` against any modified HAML files.
  #
  # @see https://github.com/brigade/haml-lint/
  class HamlLint < Base
    MESSAGE_TYPE_CATEGORIZER = lambda do |type|
      type.include?('W') ? :warning : :error
    end

    def run
      result = execute(command, args: applicable_files)
      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

28 entries across 26 versions & 2 rubygems

Version Path
overcommit-0.33.0 lib/overcommit/hook/pre_commit/haml_lint.rb
overcommit-0.32.0 lib/overcommit/hook/pre_commit/haml_lint.rb
overcommit-0.32.0.rc1 lib/overcommit/hook/pre_commit/haml_lint.rb
overcommit-0.31.0 lib/overcommit/hook/pre_commit/haml_lint.rb
overcommit-0.30.0 lib/overcommit/hook/pre_commit/haml_lint.rb
overcommit-0.29.1 lib/overcommit/hook/pre_commit/haml_lint.rb
overcommit-0.29.0 lib/overcommit/hook/pre_commit/haml_lint.rb
overcommit-0.28.0 lib/overcommit/hook/pre_commit/haml_lint.rb