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
17
18
19
20
21
22
23
24
25
# File 'lib/code_climate/test_reporter/git.rb', line 14

def branch_from_git_or_ci
  git_branch = branch_from_git
  ci_branch = Ci.service_data[:branch]

  if ci_branch.to_s.strip.size > 0
    ci_branch.sub(/^origin\//, "")
  elsif git_branch.to_s.strip.size > 0 && !git_branch.to_s.strip.start_with?("(")
    git_branch.sub(/^origin\//, "")
  else
    "master"
  end
end

.infoObject



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

def info
  {
    head:         `git log -1 --pretty=format:'%H'`,
    committed_at: committed_at,
    branch:       branch_from_git,
  }
end