Sha256: d0ce14c64f6ff60e1b6c9a4fd256a283d805ed152bf83462be2110fd932c66ce

Contents?: true

Size: 589 Bytes

Versions: 5

Compression:

Stored size: 589 Bytes

Contents

module Overcommit::Hook::PreCommit
  # Runs `stylelint` against any modified CSS file.
  #
  # @see https://github.com/stylelint/stylelint
  class Stylelint < Base
    # example of output:
    # index.css: line 4, col 4, error - Expected indentation of 2 spaces (indentation)

    MESSAGE_REGEX = /^(?<file>.+):\D*(?<line>\d).*$/

    def run
      result = execute(command, args: applicable_files)
      output = result.stdout.chomp
      return :pass if result.success? && output.empty?
      extract_messages(
        output.split("\n"),
        MESSAGE_REGEX
      )
    end
  end
end

Version data entries

5 entries across 3 versions & 2 rubygems

Version Path
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/stylelint.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/stylelint.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/stylelint.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/overcommit-0.46.0/lib/overcommit/hook/pre_commit/stylelint.rb
overcommit-0.46.0 lib/overcommit/hook/pre_commit/stylelint.rb