Commit 07be5943 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Enable Style/MultilineTernaryOperator rubocop cop

Avoid multi-line ?: (the ternary operator). Use if/unless instead.

See #17478
parent 79b02e40
...@@ -291,6 +291,10 @@ Style/MultilineMethodDefinitionBraceLayout: ...@@ -291,6 +291,10 @@ Style/MultilineMethodDefinitionBraceLayout:
Style/MultilineOperationIndentation: Style/MultilineOperationIndentation:
Enabled: false Enabled: false
# Avoid multi-line `? :` (the ternary operator), use if/unless instead.
Style/MultilineTernaryOperator:
Enabled: true
# Favor unless over if for negative conditions (or control flow or). # Favor unless over if for negative conditions (or control flow or).
Style/NegatedIf: Style/NegatedIf:
Enabled: true Enabled: true
......
...@@ -226,10 +226,6 @@ Style/LineEndConcatenation: ...@@ -226,10 +226,6 @@ Style/LineEndConcatenation:
Style/MethodCallParentheses: Style/MethodCallParentheses:
Enabled: false Enabled: false
# Offense count: 3
Style/MultilineTernaryOperator:
Enabled: false
# Offense count: 62 # Offense count: 62
# Cop supports --auto-correct. # Cop supports --auto-correct.
Style/MutableConstant: Style/MutableConstant:
......
...@@ -112,8 +112,7 @@ module Banzai ...@@ -112,8 +112,7 @@ module Banzai
end end
def current_commit def current_commit
@current_commit ||= context[:commit] || @current_commit ||= context[:commit] || ref ? repository.commit(ref) : repository.head_commit
ref ? repository.commit(ref) : repository.head_commit
end end
def relative_url_root def relative_url_root
......
...@@ -24,8 +24,11 @@ module ApiHelpers ...@@ -24,8 +24,11 @@ module ApiHelpers
(path.index('?') ? '' : '?') + (path.index('?') ? '' : '?') +
# Append private_token if given a User object # Append private_token if given a User object
(user.respond_to?(:private_token) ? if user.respond_to?(:private_token)
"&private_token=#{user.private_token}" : "") "&private_token=#{user.private_token}"
else
''
end
end end
def ci_api(path, user = nil) def ci_api(path, user = nil)
...@@ -35,8 +38,11 @@ module ApiHelpers ...@@ -35,8 +38,11 @@ module ApiHelpers
(path.index('?') ? '' : '?') + (path.index('?') ? '' : '?') +
# Append private_token if given a User object # Append private_token if given a User object
(user.respond_to?(:private_token) ? if user.respond_to?(:private_token)
"&private_token=#{user.private_token}" : "") "&private_token=#{user.private_token}"
else
''
end
end end
def json_response def json_response
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment