Enable Style/MultilineTernaryOperator rubocop cop
Avoid multi-line ?: (the ternary operator). Use if/unless instead. See #17478
This commit is contained in:
parent
79b02e40e5
commit
07be594378
4 changed files with 15 additions and 10 deletions
|
@ -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:
|
||||||
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
|
||||||
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
|
||||||
(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
|
||||||
(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
|
||||||
|
|
Loading…
Reference in a new issue