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
- .info ⇒ Object
Class Method Details
.branch_from_git_or_ci ⇒ Object
13 14 15 |
# File 'lib/code_climate/test_reporter/git.rb', line 13 def branch_from_git_or_ci clean_service_branch || clean_git_branch || "master" end |
.clean_git_branch ⇒ Object
24 25 26 27 28 29 |
# File 'lib/code_climate/test_reporter/git.rb', line 24 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
17 18 19 20 21 22 |
# File 'lib/code_climate/test_reporter/git.rb', line 17 def clean_service_branch ci_branch = String(Ci.service_data[:branch]) clean = ci_branch.strip.sub(%r{^origin/}, "") !clean.empty? ? clean : nil end |
.info ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/code_climate/test_reporter/git.rb', line 5 def info { head: head, committed_at: committed_at, branch: branch_from_git, } end |