class Supercop::Parsers::Base

Attributes

config[R]
json[R]

Public Class Methods

new(json) click to toggle source
# File lib/supercop/parsers/base.rb, line 6
def initialize(json)
  @json = json
  @config = Supercop.configuration
end

Public Instance Methods

call() click to toggle source
# File lib/supercop/parsers/base.rb, line 11
def call
  warnings_count
end

Private Instance Methods

parse() click to toggle source
# File lib/supercop/parsers/base.rb, line 17
def parse
  JSON.parse(json).count
end
parse_error(e) click to toggle source
# File lib/supercop/parsers/base.rb, line 29
def parse_error(e)
  msg = %Q[Wrong configuration for linter,
           please check the path and options provided.
           Error: #{e.message}]

  puts msg if config.verbose
end
warnings_count() click to toggle source
# File lib/supercop/parsers/base.rb, line 21
def warnings_count
  parse
rescue => e
  parse_error(e)

  'none'
end