Commit def3ab29 authored by Semyon Pupkov's avatar Semyon Pupkov

Fix rubocop Style/ZeroLengthPredicate

parent 953018e3
...@@ -808,20 +808,6 @@ Style/UnlessElse: ...@@ -808,20 +808,6 @@ Style/UnlessElse:
Style/UnneededInterpolation: Style/UnneededInterpolation:
Enabled: false Enabled: false
# Offense count: 11
# Cop supports --auto-correct.
Style/ZeroLengthPredicate:
Exclude:
- 'app/models/deploy_key.rb'
- 'app/models/network/commit.rb'
- 'app/models/network/graph.rb'
- 'app/models/project_services/asana_service.rb'
- 'app/services/boards/create_service.rb'
- 'app/services/merge_requests/conflicts/list_service.rb'
- 'lib/declarative_policy/dsl.rb'
- 'lib/extracts_path.rb'
- 'lib/gitlab/git/repository.rb'
# Offense count: 22840 # Offense count: 22840
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https # URISchemes: http, https
......
...@@ -18,7 +18,7 @@ class DeployKey < Key ...@@ -18,7 +18,7 @@ class DeployKey < Key
end end
def orphaned? def orphaned?
self.deploy_keys_projects.length == 0 self.deploy_keys_projects.empty?
end end
def almost_orphaned? def almost_orphaned?
......
...@@ -18,7 +18,7 @@ module Network ...@@ -18,7 +18,7 @@ module Network
end end
def space def space
if @spaces.size > 0 if @spaces.present?
@spaces.first @spaces.first
else else
0 0
......
...@@ -81,7 +81,7 @@ module Network ...@@ -81,7 +81,7 @@ module Network
skip = 0 skip = 0
while offset == -1 while offset == -1
tmp_commits = find_commits(skip) tmp_commits = find_commits(skip)
if tmp_commits.size > 0 if tmp_commits.present?
index = tmp_commits.index do |c| index = tmp_commits.index do |c|
c.id == @commit.id c.id == @commit.id
end end
...@@ -218,7 +218,7 @@ module Network ...@@ -218,7 +218,7 @@ module Network
def get_space_base(leaves) def get_space_base(leaves)
space_base = 1 space_base = 1
parents = leaves.last.parents(@map) parents = leaves.last.parents(@map)
if parents.size > 0 if parents.present?
if parents.first.space > 0 if parents.first.space > 0
space_base = parents.first.space space_base = parents.first.space
end end
......
...@@ -65,7 +65,7 @@ http://app.asana.com/-/account_api' ...@@ -65,7 +65,7 @@ http://app.asana.com/-/account_api'
# check the branch restriction is poplulated and branch is not included # check the branch restriction is poplulated and branch is not included
branch = Gitlab::Git.ref_name(data[:ref]) branch = Gitlab::Git.ref_name(data[:ref])
branch_restriction = restrict_to_branch.to_s branch_restriction = restrict_to_branch.to_s
if branch_restriction.length > 0 && branch_restriction.index(branch).nil? if branch_restriction.present? && branch_restriction.index(branch).nil?
return return
end end
......
...@@ -9,7 +9,7 @@ module Boards ...@@ -9,7 +9,7 @@ module Boards
private private
def can_create_board? def can_create_board?
parent.boards.size == 0 parent.boards.empty?
end end
def create_board! def create_board!
......
...@@ -54,7 +54,7 @@ module ExtractsPath ...@@ -54,7 +54,7 @@ module ExtractsPath
valid_refs = ref_names.select { |v| id.start_with?("#{v}/") } valid_refs = ref_names.select { |v| id.start_with?("#{v}/") }
if valid_refs.length == 0 if valid_refs.empty?
# No exact ref match, so just try our best # No exact ref match, so just try our best
pair = id.match(%r{([^/]+)(.*)}).captures pair = id.match(%r{([^/]+)(.*)}).captures
else else
......
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