Class: CodeClimate::TestReporter::Git
- Inherits:
-
Object
- Object
- CodeClimate::TestReporter::Git
- Defined in:
- lib/code_climate/test_reporter/git.rb
Class Method Summary collapse
- .branch_from_git_or_ci ⇒ Object
- .clean_git_branch ⇒ Object
- .clean_service_branch ⇒ Object
- .committed_at_from_git_or_ci ⇒ Object
- .head_from_git_or_ci ⇒ Object
- .info ⇒ Object
Class Method Details
.branch_from_git_or_ci ⇒ Object
17 18 19 |
# File 'lib/code_climate/test_reporter/git.rb', line 17 def branch_from_git_or_ci clean_service_branch || clean_git_branch || "master" end |
.clean_git_branch ⇒ Object
32 33 34 35 36 37 |
# File 'lib/code_climate/test_reporter/git.rb', line 32 def clean_git_branch git_branch = String(branch_from_git) clean = git_branch.sub(%r{^origin/}, "") unless git_branch.start_with?("(") !clean.empty? ? clean : nil end |
.clean_service_branch ⇒ Object
25 26 27 28 29 30 |
# File 'lib/code_climate/test_reporter/git.rb', line 25 def clean_service_branch ci_branch = String(Ci.service_data[:branch]) clean = ci_branch.strip.sub(%r{^origin/}, "") !clean.empty? ? clean : nil end |
.committed_at_from_git_or_ci ⇒ Object
21 22 23 |
# File 'lib/code_climate/test_reporter/git.rb', line 21 def committed_at_from_git_or_ci committed_at_from_git || committed_at_from_ci end |
.head_from_git_or_ci ⇒ Object
13 14 15 |
# File 'lib/code_climate/test_reporter/git.rb', line 13 def head_from_git_or_ci head_from_git || head_from_ci end |
.info ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/code_climate/test_reporter/git.rb', line 5 def info { head: head_from_git_or_ci, committed_at: committed_at_from_git_or_ci, branch: branch_from_git_or_ci, } end |