module CodeClimate::TestReporter

Constants

InvalidPayload
VERSION
WARNING_MESSAGE

Public Class Methods

ci_service_data() click to toggle source
# File lib/code_climate/test_reporter.rb, line 67
def self.ci_service_data
  Ci.service_data
end
configuration() click to toggle source
# File lib/code_climate/test_reporter/configuration.rb, line 17
def self.configuration
  @@configuration || configure
end
configure() { |configuration| ... } click to toggle source
# File lib/code_climate/test_reporter/configuration.rb, line 7
def self.configure
  @@configuration = Configuration.new

  if block_given?
    yield configuration
  end

  configuration
end
configured_branch() click to toggle source
# File lib/code_climate/test_reporter.rb, line 51
def self.configured_branch
  configuration.branch
end
current_branch() click to toggle source
# File lib/code_climate/test_reporter.rb, line 55
def self.current_branch
  Git.branch_from_git_or_ci
end
environment_variable_set?() click to toggle source
# File lib/code_climate/test_reporter.rb, line 27
def self.environment_variable_set?
  return @environment_variable_set if defined?(@environment_variable_set)

  @environment_variable_set = !!ENV["CODECLIMATE_REPO_TOKEN"]
  if @environment_variable_set
    logger.info("Reporting coverage data to Code Climate.")
  end

  @environment_variable_set
end
logger() click to toggle source
# File lib/code_climate/test_reporter.rb, line 59
def self.logger
  CodeClimate::TestReporter.configuration.logger
end
run(results) click to toggle source
# File lib/code_climate/test_reporter.rb, line 17
def self.run(results)
  return unless CodeClimate::TestReporter.run?
  formatted_results = CodeClimate::TestReporter::Formatter.new.format(results)
  CodeClimate::TestReporter::PostResults.new(formatted_results).post
end
run?() click to toggle source
# File lib/code_climate/test_reporter.rb, line 23
def self.run?
  environment_variable_set? && run_on_current_branch?
end
run_on_current_branch?() click to toggle source
# File lib/code_climate/test_reporter.rb, line 38
def self.run_on_current_branch?
  return @run_on_current_branch if defined?(@run_on_current_branch)

  @run_on_current_branch = true if configured_branch.nil?
  @run_on_current_branch ||= !!(current_branch =~ /#{configured_branch}/i)

  unless @run_on_current_branch
    logger.info("Not reporting to Code Climate because #{configured_branch} is set as the reporting branch.")
  end

  @run_on_current_branch
end
start() click to toggle source
# File lib/code_climate/test_reporter.rb, line 12
def self.start
  logger.warn(WARNING_MESSAGE)
  exit(1)
end
tddium?() click to toggle source
# File lib/code_climate/test_reporter.rb, line 63
def self.tddium?
  ci_service_data && ci_service_data[:name] == "tddium"
end