Commit 6f8156ce authored by Robert Speicher's avatar Robert Speicher

Merge branch 'rubocop/enable-multiline-ternary-operator-cop' into 'master'

Enable Style/MultilineTernaryOperator rubocop cop

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

See #17478

See merge request !4356
parents 639942ef 07be5943
......@@ -291,6 +291,10 @@ Style/MultilineMethodDefinitionBraceLayout:
Style/MultilineOperationIndentation:
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).
Style/NegatedIf:
Enabled: true
......
......@@ -226,10 +226,6 @@ Style/LineEndConcatenation:
Style/MethodCallParentheses:
Enabled: false
# Offense count: 3
Style/MultilineTernaryOperator:
Enabled: false
# Offense count: 62
# Cop supports --auto-correct.
Style/MutableConstant:
......
......@@ -112,8 +112,7 @@ module Banzai
end
def current_commit
@current_commit ||= context[:commit] ||
ref ? repository.commit(ref) : repository.head_commit
@current_commit ||= context[:commit] || ref ? repository.commit(ref) : repository.head_commit
end
def relative_url_root
......
......@@ -24,8 +24,11 @@ module ApiHelpers
(path.index('?') ? '' : '?') +
# Append private_token if given a User object
(user.respond_to?(:private_token) ?
"&private_token=#{user.private_token}" : "")
if user.respond_to?(:private_token)
"&private_token=#{user.private_token}"
else
''
end
end
def ci_api(path, user = nil)
......@@ -35,8 +38,11 @@ module ApiHelpers
(path.index('?') ? '' : '?') +
# Append private_token if given a User object
(user.respond_to?(:private_token) ?
"&private_token=#{user.private_token}" : "")
if user.respond_to?(:private_token)
"&private_token=#{user.private_token}"
else
''
end
end
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