class Circlemator::CodeAnalyser

Public Class Methods

new(opts) click to toggle source
# File lib/circlemator/code_analyser.rb, line 10
def initialize(opts)
  @opts = opts
  @base_branch = opts.fetch(:base_branch)
end

Public Instance Methods

check_coverage() click to toggle source
# File lib/circlemator/code_analyser.rb, line 15
def check_coverage
  require 'pronto/undercover'
  run_pronto
end
check_security() click to toggle source
# File lib/circlemator/code_analyser.rb, line 25
def check_security
  require 'pronto/brakeman'
  run_pronto
end
check_style() click to toggle source
# File lib/circlemator/code_analyser.rb, line 20
def check_style
  require 'pronto/rubocop'
  run_pronto
end

Private Instance Methods

formatter() click to toggle source
# File lib/circlemator/code_analyser.rb, line 36
def formatter
  pr_number, _ = PrFinder.new(@opts).find_pr
  if pr_number
    ENV['PRONTO_PULL_REQUEST_ID'] = pr_number.to_s
    Pronto::Formatter::GithubPullRequestFormatter.new
  else
    Pronto::Formatter::GithubFormatter.new
  end
end
run_pronto() click to toggle source
# File lib/circlemator/code_analyser.rb, line 32
def run_pronto
  Pronto.run("origin/#{@base_branch}", '.', formatter)
end