Class: Maximus::Jshint

Inherits:
Lint
  • Object
show all
Defined in:
lib/maximus/lints/jshint.rb

Overview

Since:

  • 0.1.0

Instance Attribute Summary

Attributes inherited from Lint

#output

Instance Method Summary collapse

Methods inherited from Lint

#initialize, #refine

Methods included from Helper

#check_default_config_path, #edit_yaml, #file_count, #file_list, #is_rails?, #lines_added_to_range, #node_module_exists, #path_exists, #prompt, #reporter_path, #root_dir, #truthy

Constructor Details

This class inherits a constructor from Maximus::Lint

Instance Method Details

#resultObject

JSHint (requires node module)

See Also:

Since:

  • 0.1.0


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/maximus/lints/jshint.rb', line 8

def result
  @task = 'jshint'

  return unless temp_config(@task)

  @path = is_rails? ? "#{@settings[:root_dir]}/app/assets" : "#{@settings[:root_dir]}source/assets" if @path.blank?

  return unless path_exists(@path)

  node_module_exists(@task)

  jshint_cli = "jshint #{@path} --config=#{temp_config(@task)} --reporter=#{reporter_path('jshint.js')}"
  jshint_cli += " --exclude-path=#{temp_config(@settings[:jshintignore])}" if @settings.has_key?(:jshintignore)
  jshint = `#{jshint_cli}`

  @output[:files_inspected] ||= files_inspected('js')
  refine jshint
end