class Codacy::Formatter

Public Instance Methods

format(result) click to toggle source
# File lib/codacy/formatter.rb, line 4
def format(result)
  if should_run?
    parse_result = Codacy::Parser.parse_file(result)
    Codacy::ClientAPI.post_results(parse_result, partial: partial)
  else
    logger.info("Running locally, skipping Codacy coverage")
  end
rescue => ex
  logger.fatal(ex)
  false
end

Private Instance Methods

logger() click to toggle source
# File lib/codacy/formatter.rb, line 26
def logger
  Codacy::Configuration.logger
end
partial() click to toggle source
# File lib/codacy/formatter.rb, line 18
def partial
  false
end
should_run?() click to toggle source
# File lib/codacy/formatter.rb, line 22
def should_run?
  ENV["CI"] || ENV["JENKINS_URL"] || ENV['TDDIUM'] || ENV["CODACY_RUN_LOCAL"]
end