Sha256: b3bc0524503aaa4b445a05688916e5b0fd5eaac4a8f444487e75d478ac02e7e7
Contents?: true
Size: 503 Bytes
Versions: 8
Compression:
Stored size: 503 Bytes
Contents
module PreCommit module Checks class GoFmt < Plugin def call(staged_files) staged_files = staged_files.grep(/\.go$/) return if staged_files.empty? errors = staged_files.map { |file| run_check(file) }.compact return if errors.empty? errors.join("\n") end def run_check(file) cmd = "gofmt -l #{file} 2>&1" %x[ #{cmd} ] end def self.description "Detects bad Go formatting" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems