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: ...@@ -877,7 +877,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 ...@@ -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 ...@@ -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 ...@@ -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'
......
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