Class: PreCommit::JshintCheck
- Defined in:
- lib/pre-commit/checks/jshint_check.rb
Class Method Summary collapse
Methods inherited from JsCheck
Class Method Details
.check_name ⇒ Object
13 14 15 |
# File 'lib/pre-commit/checks/jshint_check.rb', line 13 def self.check_name "JSHint" end |
.config ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/pre-commit/checks/jshint_check.rb', line 5 def self.config if config_file = [ENV['JSHINT_CONFIG'], ".jshintrc"].compact.detect { |f| File.exist?(f) } ExecJS.exec("return (#{File.read(config_file)});") else {} end end |
.linter_src ⇒ Object
22 23 24 |
# File 'lib/pre-commit/checks/jshint_check.rb', line 22 def self.linter_src File.("../../support/jshint/jshint.js", __FILE__) end |
.run_check(file) ⇒ Object
17 18 19 20 |
# File 'lib/pre-commit/checks/jshint_check.rb', line 17 def self.run_check(file) context = ExecJS.compile(File.read(linter_src)) context.call('JSHINT', File.read(file), config) end |