Class: Maximus::Jshint

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

Overview

Evaluates quality of JavaScript

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

#discover_path, #edit_yaml, #file_count, #file_list, #is_middleman?, #is_rails?, #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
# File 'lib/maximus/lints/jshint.rb', line 8

def result
  @task = 'jshint'
  @path = discover_path(@config.working_dir, 'javascripts', 'js')

  return unless temp_config(@task) && 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.key?(:jshintignore)
  jshint = `#{jshint_cli}`

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