Class: PreCommit::Checks::Jshint

Inherits:
Js
  • Object
show all
Defined in:
lib/plugins/pre_commit/checks/jshint.rb

Instance Attribute Summary

Attributes inherited from Plugin

#config, #pluginator

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Js

#call, #display_error, #error_selector, #files_filter

Methods inherited from Plugin

#initialize, #name

Constructor Details

This class inherits a constructor from PreCommit::Checks::Plugin

Class Method Details

.descriptionObject


19
20
21
# File 'lib/plugins/pre_commit/checks/jshint.rb', line 19

def self.description
  "Checks javascript files with JSHint."
end

Instance Method Details

#alternate_config_fileObject


15
16
17
# File 'lib/plugins/pre_commit/checks/jshint.rb', line 15

def alternate_config_file
  ".jshintrc"
end

#linter_srcObject


11
12
13
# File 'lib/plugins/pre_commit/checks/jshint.rb', line 11

def linter_src
  File.expand_path("../../../../pre-commit/support/jshint/jshint.js", __FILE__)
end

#run_check(file) ⇒ Object


7
8
9
# File 'lib/plugins/pre_commit/checks/jshint.rb', line 7

def run_check(file)
  context.call("JSHINT._getErrors", File.read(file), js_config, js_config["globals"])
end