Class: PreCommit::JslintCheck
- Defined in:
- lib/pre-commit/checks/jslint_check.rb
Class Method Summary collapse
Methods inherited from JsCheck
Class Method Details
.check_name ⇒ Object
5 6 7 |
# File 'lib/pre-commit/checks/jslint_check.rb', line 5 def self.check_name "JSLint" end |
.linter_src ⇒ Object
18 19 20 |
# File 'lib/pre-commit/checks/jslint_check.rb', line 18 def self.linter_src File.("../../support/jslint/lint.js", __FILE__) end |
.run_check(file) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/pre-commit/checks/jslint_check.rb', line 9 def self.run_check(file) context = ExecJS.compile(File.read(linter_src)) if !(context.call('JSLINT', File.read(file))) context.exec('return JSLINT.errors;') else [] end end |