class Pronto::GolangTools::Base

Public Class Methods

base_command() click to toggle source
# File lib/pronto/golang/tools/base.rb, line 4
def self.base_command
  raise 'base_command needs to be overwritten in inheritance'
end
new(config) click to toggle source
# File lib/pronto/golang/tools/base.rb, line 12
def initialize(config)
  @config = config
end

Public Instance Methods

available?() click to toggle source
# File lib/pronto/golang/tools/base.rb, line 28
def available?
  installed? && enabled?
end
base_command() click to toggle source
# File lib/pronto/golang/tools/base.rb, line 8
def base_command
  self.class.base_command
end
blacklisted_files_regexp() click to toggle source
# File lib/pronto/golang/tools/base.rb, line 24
def blacklisted_files_regexp
  @regexp ||= Regexp.new(@config.fetch('blacklisted_files', '^(?!.*)$'))
end
command(file_path) click to toggle source
# File lib/pronto/golang/tools/base.rb, line 16
def command(file_path)
  "#{base_command} #{parameters} #{file_path}"
end
enabled?() click to toggle source
# File lib/pronto/golang/tools/base.rb, line 36
def enabled?
  @config.fetch('enabled', true) # Default to true if the key is not configured
end
installed?() click to toggle source
# File lib/pronto/golang/tools/base.rb, line 32
def installed?
  `which #{base_command}` != ""
end
parameters() click to toggle source
# File lib/pronto/golang/tools/base.rb, line 20
def parameters
  @config.fetch('parameters', '') # Default to '' if the key is not configured
end
parse_line(line) click to toggle source
# File lib/pronto/golang/tools/base.rb, line 40
def parse_line(line)
  file_path, line_number, _, message = line.split(':', 4)

  return file_path, line_number, :warning, message.to_s.strip
end