summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Shea <connor.james.shea@gmail.com>2016-07-15 14:08:27 -0600
committerConnor Shea <connor.james.shea@gmail.com>2016-07-19 12:31:24 -0600
commit737e5226f87b06c2fe8633819bce1fde16308f19 (patch)
treed5755143f325959fdff83ad7d5da990882180ff5
parentb2a79554c339a583b6cc0d471b8224a24f11c96d (diff)
downloadgitlab-ce-737e5226f87b06c2fe8633819bce1fde16308f19.tar.gz
Use switch statements instead of if/else chains.
-rw-r--r--app/assets/javascripts/merge_request_widget.js.coffee13
-rw-r--r--app/helpers/ci_status_helper.rb5
2 files changed, 10 insertions, 8 deletions
diff --git a/app/assets/javascripts/merge_request_widget.js.coffee b/app/assets/javascripts/merge_request_widget.js.coffee
index 31f5cb93a51..963a0550c35 100644
--- a/app/assets/javascripts/merge_request_widget.js.coffee
+++ b/app/assets/javascripts/merge_request_widget.js.coffee
@@ -55,12 +55,13 @@ class @MergeRequestWidget
$('.mr-state-widget').replaceWith(data)
ciLabelForStatus: (status) ->
- if status is 'success'
- 'passed'
- else if status is 'success_with_warnings'
- 'passed with warnings'
- else
- status
+ switch status
+ when 'success'
+ 'passed'
+ when 'success_with_warnings'
+ 'passed with warnings'
+ else
+ status
pollCIStatus: ->
@fetchBuildStatusInterval = setInterval ( =>
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb
index c9217b846e7..44b8b7f6ca1 100644
--- a/app/helpers/ci_status_helper.rb
+++ b/app/helpers/ci_status_helper.rb
@@ -15,9 +15,10 @@ module CiStatusHelper
end
def ci_label_for_status(status)
- if status == 'success'
+ case status
+ when 'success'
'passed'
- elsif status == 'success_with_warnings'
+ when 'success_with_warnings'
'passed with warnings'
else
status