Class: Phare::Check::JSHint

Inherits:
Phare::Check show all
Defined in:
lib/phare/check/jshint.rb

Instance Attribute Summary collapse

Attributes inherited from Phare::Check

#status, #tree

Instance Method Summary collapse

Methods inherited from Phare::Check

#run, #should_run?

Constructor Details

#initialize(directory, options = {}) ⇒ JSHint

Returns a new instance of JSHint.



7
8
9
10
11
12
13
14
15
# File 'lib/phare/check/jshint.rb', line 7

def initialize(directory, options = {})
  @config = File.expand_path("#{directory}.jshintrc", __FILE__)
  @path = File.expand_path("#{directory}app/assets/javascripts", __FILE__)
  @glob = File.join(@path, '**/*')
  @extensions = %w(.js .es6)
  @options = options

  super
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/phare/check/jshint.rb', line 5

def config
  @config
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/phare/check/jshint.rb', line 5

def path
  @path
end

Instance Method Details

#commandObject



17
18
19
20
21
22
23
# File 'lib/phare/check/jshint.rb', line 17

def command
  if @tree.changed?
    "jshint --config #{@config} --extra-ext #{@extensions.join(',')} #{files_to_check.join(' ')}"
  else
    "jshint --config #{@config} --extra-ext #{@extensions.join(',')} #{@glob}"
  end
end