Sha256: d3cd5a781956eee48a8db3aff48dd1912a4c06bd384d91ad6dec9298c64914ce
Contents?: true
Size: 1002 Bytes
Versions: 1
Compression:
Stored size: 1002 Bytes
Contents
# -*- encoding : utf-8 -*- require 'open3' require 'pre-commit/checks/plugin' module PreCommit module Checks # Runs checkstyle against java files class Checkstyle < Plugin def call(staged_files) staged_files = staged_files.grep(/\.java$/) return if staged_files.empty? args = (jar_flag + config_file_flag + checks_file_flag + staged_files).join(' ') puts "java #{args}" stdout, stderr, result = Open3.capture3("java #{args}") stdout + stderr unless result.success? end def jar_flag ['-jar', File.expand_path('../../../../gazelle_styleguide/support/checkstyle-5.7-all.jar', __FILE__)] end def config_file_flag ENV['CHECKSTYLE_CONFIG'] ? ['-p', ENV['CHECKSTYLE_CONFIG']] : [] end def checks_file_flag ENV['CHECKSTYLE_CHECKS'] ? ['-c', ENV['CHECKSTYLE_CHECKS']] : [] end def self.description 'Runs coffeelint to detect errors' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gazelle_styleguide-0.0.1 | lib/plugins/pre_commit/checks/checkstyle.rb |