Sha256: 447fafdb2d81227e05ff01dc26204abe5ca71706264d0f208975910485724dca

Contents?: true

Size: 590 Bytes

Versions: 31

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

module Overcommit::Hook::PreCommit
  # Runs `slim-lint` against any modified Slim templates.
  #
  # @see https://github.com/sds/slim-lint
  class SlimLint < 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

31 entries across 31 versions & 2 rubygems

Version Path
overcommit-jeygeethanmedia-0.53.1 lib/overcommit/hook/pre_commit/slim_lint.rb
overcommit-0.53.0 lib/overcommit/hook/pre_commit/slim_lint.rb
overcommit-0.52.1 lib/overcommit/hook/pre_commit/slim_lint.rb
overcommit-0.52.0 lib/overcommit/hook/pre_commit/slim_lint.rb
overcommit-0.51.0 lib/overcommit/hook/pre_commit/slim_lint.rb
overcommit-0.50.0 lib/overcommit/hook/pre_commit/slim_lint.rb
overcommit-0.49.1 lib/overcommit/hook/pre_commit/slim_lint.rb
overcommit-0.49.0 lib/overcommit/hook/pre_commit/slim_lint.rb
overcommit-0.48.1 lib/overcommit/hook/pre_commit/slim_lint.rb
overcommit-0.48.0 lib/overcommit/hook/pre_commit/slim_lint.rb
overcommit-0.47.0 lib/overcommit/hook/pre_commit/slim_lint.rb