Enable Lint/LiteralInCondition rubocop cop

Checks of literals used in conditions.

See #17478
This commit is contained in:
Grzegorz Bizon 2016-05-30 12:34:25 +02:00
parent 43c35b0f20
commit 86cf9dd253
4 changed files with 10 additions and 12 deletions

View File

@ -878,7 +878,7 @@ Lint/InvalidCharacterLiteral:
# Checks of literals used in conditions.
Lint/LiteralInCondition:
Enabled: false
Enabled: true
# Checks for literals used in interpolation.
Lint/LiteralInInterpolation:

View File

@ -25,18 +25,17 @@ class Ability
# List of possible abilities for anonymous user
def anonymous_abilities(user, subject)
case true
when subject.is_a?(PersonalSnippet)
if subject.is_a?(PersonalSnippet)
anonymous_personal_snippet_abilities(subject)
when subject.is_a?(ProjectSnippet)
elsif subject.is_a?(ProjectSnippet)
anonymous_project_snippet_abilities(subject)
when subject.is_a?(CommitStatus)
elsif subject.is_a?(CommitStatus)
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)
when subject.is_a?(Group) || subject.respond_to?(:group)
elsif subject.is_a?(Group) || subject.respond_to?(:group)
anonymous_group_abilities(subject)
when subject.is_a?(User)
elsif subject.is_a?(User)
anonymous_user_abilities
else
[]

View File

@ -70,7 +70,7 @@ class IrkerService < Service
private
def get_channels
return true unless :activated?
return true unless activated?
return true if recipients.nil? || recipients.empty?
map_recipients

View File

@ -79,10 +79,9 @@ module Gitlab
end
def state
@state ||= case true
when raw_data.state == 'closed' && raw_data.merged_at.present?
@state ||= if raw_data.state == 'closed' && raw_data.merged_at.present?
'merged'
when raw_data.state == 'closed'
elsif raw_data.state == 'closed'
'closed'
else
'opened'