Class: PreCommit::Checks::ClosureLinter
- Inherits:
-
Plugin
- Object
- Plugin
- PreCommit::Checks::ClosureLinter
- Defined in:
- lib/plugins/pre_commit/checks/closure_linter.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.description ⇒ Object
21 22 23 |
# File 'lib/plugins/pre_commit/checks/closure_linter.rb', line 21 def self.description "Runs closure linter syntax check" end |
Instance Method Details
#alternate_config_file ⇒ Object
17 18 19 |
# File 'lib/plugins/pre_commit/checks/closure_linter.rb', line 17 def alternate_config_file '.gjslintrc' end |
#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 #{gjslint_options} #{staged_files.join(" ")}` return if output =~ /(\d*) files checked, no errors found(.*)/ output end |
#gjslint_options ⇒ Object
25 26 27 28 29 |
# File 'lib/plugins/pre_commit/checks/closure_linter.rb', line 25 def return '' unless config_file File.readlines(config_file).map(&:chomp).join(' ') end |