Commit ea329376 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'rubocop/enable-literal-in-condition-cop' into 'master'

Enable Lint/LiteralInCondition rubocop cop

Detects literals used in conditions.

See #17478

See merge request !4354
parents 7a6d069f 86cf9dd2
......@@ -877,7 +877,7 @@ Lint/InvalidCharacterLiteral:
# Checks of literals used in conditions.
Lint/LiteralInCondition:
Enabled: false
Enabled: true
# Checks for literals used in interpolation.
Lint/LiteralInInterpolation:
......
......@@ -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
[]
......
......@@ -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
......
......@@ -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'
......
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