class PreCommit::Checks::ClosureLinter

Public Class Methods

description() click to toggle source
# File lib/plugins/pre_commit/checks/closure_linter.rb, line 21
def self.description
  "Runs closure linter syntax check"
end

Public Instance Methods

alternate_config_file() click to toggle source
# File lib/plugins/pre_commit/checks/closure_linter.rb, line 17
def alternate_config_file
  '.gjslintrc'
end
call(staged_files) click to toggle source
# File lib/plugins/pre_commit/checks/closure_linter.rb, line 7
def call(staged_files)
  staged_files = staged_files.grep(/\.js$/)
  return if staged_files.empty?

  output = `gjslint #{gjslint_options} #{staged_files.join(" ")}`
  return if output =~ /(\d*) files checked, no errors found(.*)/

  output
end
gjslint_options() click to toggle source
# File lib/plugins/pre_commit/checks/closure_linter.rb, line 25
def gjslint_options
  return '' unless config_file

  File.readlines(config_file).map(&:chomp).join(' ')
end