Class: JSHint4r::Reporter::Text

Inherits:
Object
  • Object
show all
Includes:
JSHint4r::Reporter
Defined in:
lib/jshint4r/reporter/text.rb

Overview

like output of npm’s jshint

Instance Method Summary collapse

Methods included from JSHint4r::Reporter

#key_symbolize

Instance Method Details

#report(target, errors, verbose = false) ⇒ Object

param

String target

param

Array errors

return

String



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jshint4r/reporter/text.rb', line 14

def report( target, errors, verbose = false )
  if errors
    errors.map { |error|
      e = key_symbolize( error )
      sprintf( "%s: line %s, col %s, %s",
        target, e[:line], e[:character], e[:reason] )
    }.join("\n") + <<EOD


#{errors.size} errors
EOD
  elsif verbose
    sprintf( "%s ... ok\n", target )
  end
end