Class: PreCommit::Checks::ClosureLinter

Inherits:
Plugin
  • Object
show all
Defined in:
lib/plugins/pre_commit/checks/closure_linter.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.descriptionObject



17
18
19
# File 'lib/plugins/pre_commit/checks/closure_linter.rb', line 17

def self.description
  "Runs closure linter syntax check"
end

Instance Method Details

#call(staged_files) ⇒ Object



7
8
9
10
11
12
13
14
15
# 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 --nojsdoc #{staged_files.join(" ")}`
  return if output =~ /(\d*) files checked, no errors found(.*)/

  output
end