Sha256: ba129e47357a94946fc2ffdfbcf64e88de95fbc29c306b2a6432599810cd4df0

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

module Overcommit::Hook::PreCommit
  # Runs `standard` against any modified JavaScript files.
  #
  # @see https://github.com/feross/standard
  class Standard < Base
    def run
      result = execute(command + applicable_files)
      output = result.stderr.chomp
      return :pass if result.success? && output.empty?

      # example message:
      #   path/to/file.js:1:1: Error message (ruleName)
      extract_messages(
        output.split("\n")[1..-1], # ignore header line
        /^(?<file>[^:]+):(?<line>\d+)/
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
overcommit-0.26.0 lib/overcommit/hook/pre_commit/standard.rb