Enable Lint/LiteralInCondition rubocop cop
Checks of literals used in conditions. See #17478
This commit is contained in:
parent
43c35b0f20
commit
86cf9dd253
|
@ -878,7 +878,7 @@ Lint/InvalidCharacterLiteral:
|
||||||
|
|
||||||
# Checks of literals used in conditions.
|
# Checks of literals used in conditions.
|
||||||
Lint/LiteralInCondition:
|
Lint/LiteralInCondition:
|
||||||
Enabled: false
|
Enabled: true
|
||||||
|
|
||||||
# Checks for literals used in interpolation.
|
# Checks for literals used in interpolation.
|
||||||
Lint/LiteralInInterpolation:
|
Lint/LiteralInInterpolation:
|
||||||
|
|
|
@ -25,18 +25,17 @@ class Ability
|
||||||
|
|
||||||
# List of possible abilities for anonymous user
|
# List of possible abilities for anonymous user
|
||||||
def anonymous_abilities(user, subject)
|
def anonymous_abilities(user, subject)
|
||||||
case true
|
if subject.is_a?(PersonalSnippet)
|
||||||
when subject.is_a?(PersonalSnippet)
|
|
||||||
anonymous_personal_snippet_abilities(subject)
|
anonymous_personal_snippet_abilities(subject)
|
||||||
when subject.is_a?(ProjectSnippet)
|
elsif subject.is_a?(ProjectSnippet)
|
||||||
anonymous_project_snippet_abilities(subject)
|
anonymous_project_snippet_abilities(subject)
|
||||||
when subject.is_a?(CommitStatus)
|
elsif subject.is_a?(CommitStatus)
|
||||||
anonymous_commit_status_abilities(subject)
|
anonymous_commit_status_abilities(subject)
|
||||||
when subject.is_a?(Project) || subject.respond_to?(:project)
|
elsif subject.is_a?(Project) || subject.respond_to?(:project)
|
||||||
anonymous_project_abilities(subject)
|
anonymous_project_abilities(subject)
|
||||||
when subject.is_a?(Group) || subject.respond_to?(:group)
|
elsif subject.is_a?(Group) || subject.respond_to?(:group)
|
||||||
anonymous_group_abilities(subject)
|
anonymous_group_abilities(subject)
|
||||||
when subject.is_a?(User)
|
elsif subject.is_a?(User)
|
||||||
anonymous_user_abilities
|
anonymous_user_abilities
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
|
|
|
@ -70,7 +70,7 @@ class IrkerService < Service
|
||||||
private
|
private
|
||||||
|
|
||||||
def get_channels
|
def get_channels
|
||||||
return true unless :activated?
|
return true unless activated?
|
||||||
return true if recipients.nil? || recipients.empty?
|
return true if recipients.nil? || recipients.empty?
|
||||||
|
|
||||||
map_recipients
|
map_recipients
|
||||||
|
|
|
@ -79,10 +79,9 @@ module Gitlab
|
||||||
end
|
end
|
||||||
|
|
||||||
def state
|
def state
|
||||||
@state ||= case true
|
@state ||= if raw_data.state == 'closed' && raw_data.merged_at.present?
|
||||||
when raw_data.state == 'closed' && raw_data.merged_at.present?
|
|
||||||
'merged'
|
'merged'
|
||||||
when raw_data.state == 'closed'
|
elsif raw_data.state == 'closed'
|
||||||
'closed'
|
'closed'
|
||||||
else
|
else
|
||||||
'opened'
|
'opened'
|
||||||
|
|
Loading…
Reference in New Issue