Sha256: 37b7d5fef3daff6065db308fd9c0a16e4c47bf23c74f2d27d55b8ae84636f74d

Contents?: true

Size: 501 Bytes

Versions: 3

Compression:

Stored size: 501 Bytes

Contents

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

    def run
      result = execute([executable] + applicable_files)
      return :pass if result.success?

      extract_messages(
        result.stdout.split("\n"),
        /^(?<file>[^:]+):(?<line>\d+)[^ ]* (?<type>[^ ]+)/,
        MESSAGE_TYPE_CATEGORIZER,
      )
    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/haml_lint.rb
overcommit-0.21.0 lib/overcommit/hook/pre_commit/haml_lint.rb
overcommit-0.20.0 lib/overcommit/hook/pre_commit/haml_lint.rb