Sha256: 1abd02703c6e6c4b3d577fc73f2f471ca03600d38dbf3fceb111f134b1db40a1

Contents?: true

Size: 410 Bytes

Versions: 8

Compression:

Stored size: 410 Bytes

Contents

module Overcommit::GitHook
  class RubySyntax < HookSpecificCheck
    include HookRegistry
    file_type :rb

    def run_check
      clean = true
      output = []
      staged.each do |staged|
        syntax = `ruby -c #{staged} 2>&1`
        unless $?.success?
          output += syntax.lines.to_a
          clean = false
        end
      end
      return (clean ? :good : :bad), output
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
overcommit-0.1.7 lib/overcommit/plugins/pre_commit/ruby_syntax.rb
overcommit-0.1.6 lib/overcommit/plugins/pre_commit/ruby_syntax.rb
overcommit-0.1.5 lib/overcommit/plugins/pre_commit/ruby_syntax.rb
overcommit-0.1.4 lib/overcommit/plugins/pre_commit/ruby_syntax.rb
overcommit-0.1.3 lib/overcommit/plugins/pre_commit/ruby_syntax.rb
overcommit-0.1.2 lib/overcommit/plugins/pre_commit/ruby_syntax.rb
overcommit-0.1.1 lib/overcommit/plugins/pre_commit/ruby_syntax.rb
overcommit-0.1.0 lib/overcommit/plugins/pre_commit/ruby_syntax.rb