Class: CodeClimate::TestReporter::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/code_climate/test_reporter/git.rb

Class Method Summary collapse

Class Method Details

.branch_from_git_or_ciObject



14
15
16
# File 'lib/code_climate/test_reporter/git.rb', line 14

def branch_from_git_or_ci
  clean_service_branch || clean_git_branch || "master"
end

.clean_git_branchObject



25
26
27
28
29
30
# File 'lib/code_climate/test_reporter/git.rb', line 25

def clean_git_branch
  git_branch = String(branch_from_git)
  clean = git_branch.sub(/^origin\//, "") unless git_branch.start_with?("(")

  clean.size > 0 ? clean : nil
end

.clean_service_branchObject



18
19
20
21
22
23
# File 'lib/code_climate/test_reporter/git.rb', line 18

def clean_service_branch
  ci_branch = String(Ci.service_data[:branch])
  clean = ci_branch.strip.sub(/^origin\//, "")

  clean.size > 0 ? clean : nil
end

.infoObject



6
7
8
9
10
11
12
# File 'lib/code_climate/test_reporter/git.rb', line 6

def info
  {
    head:         head,
    committed_at: committed_at,
    branch:       branch_from_git,
  }
end