summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-05-30 12:34:25 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-05-30 12:34:25 +0200
commit86cf9dd2535adac3d739edbb845f7388e42f447d (patch)
tree4bb229abae9593b98d5020d08ace129678c3534d
parent43c35b0f20fb3bb67ea2b96bf8f806c7e95b6aec (diff)
downloadgitlab-ce-rubocop/enable-literal-in-condition-cop.tar.gz
Enable Lint/LiteralInCondition rubocop coprubocop/enable-literal-in-condition-cop
Checks of literals used in conditions. See #17478
-rw-r--r--.rubocop.yml2
-rw-r--r--app/models/ability.rb13
-rw-r--r--app/models/project_services/irker_service.rb2
-rw-r--r--lib/gitlab/github_import/pull_request_formatter.rb5
4 files changed, 10 insertions, 12 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 2d8eb4077f3..6391b8336aa 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -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:
diff --git a/app/models/ability.rb b/app/models/ability.rb
index b354b1990c7..8c5b255223d 100644
--- a/app/models/ability.rb
+++ b/app/models/ability.rb
@@ -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
[]
diff --git a/app/models/project_services/irker_service.rb b/app/models/project_services/irker_service.rb
index 91015e6c9b1..2e5e854fc5e 100644
--- a/app/models/project_services/irker_service.rb
+++ b/app/models/project_services/irker_service.rb
@@ -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
diff --git a/lib/gitlab/github_import/pull_request_formatter.rb b/lib/gitlab/github_import/pull_request_formatter.rb
index 574737b31c1..a2947b56ad9 100644
--- a/lib/gitlab/github_import/pull_request_formatter.rb
+++ b/lib/gitlab/github_import/pull_request_formatter.rb
@@ -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'