Sha256: 3e37818068ec1be6ce7b0128a1dad36bd29bbd0019be2ad0aab8a4a3460232fa

Contents?: true

Size: 556 Bytes

Versions: 1

Compression:

Stored size: 556 Bytes

Contents

module Overcommit::Hook::PreCommit
  # Runs `semistandard` against any modified JavaScript files.
  #
  # @see https://github.com/Flet/semistandard
  class SemiStandard < 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/semi_standard.rb