Skip to content

Commit

Permalink
[ci] Fix Style/ZeroLengthPredicate complains
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kang committed Dec 13, 2017
1 parent bc5f447 commit f8d00f2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
8 changes: 0 additions & 8 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1070,11 +1070,3 @@ Style/YodaCondition:
- 'src/api/app/mixins/request_source_diff.rb'
- 'src/api/app/models/bs_request.rb'
- 'src/api/app/models/bs_request_permission_check.rb'

# Offense count: 5
# Cop supports --auto-correct.
Style/ZeroLengthPredicate:
Exclude:
- 'src/api/app/views/attribute/attribute_definition.xml.builder'
- 'src/api/app/views/attribute/namespace_definition.xml.builder'
- 'src/api/app/views/webui/feeds/commits.atom.builder'
6 changes: 3 additions & 3 deletions src/api/app/views/attribute/attribute_definition.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ xml.definition(p) do |attr|
attr.description @at.description
end

if @at.default_values.length > 0
if @at.default_values.present?
attr.default do |default|
@at.default_values.each do |def_val|
default.value def_val.value
end
end
end

if @at.allowed_values.length > 0
if @at.allowed_values.present?
attr.allowed do |allowed|
@at.allowed_values.each do |all_val|
allowed.value all_val.value
Expand All @@ -32,7 +32,7 @@ xml.definition(p) do |attr|
end

abies = @at.attrib_type_modifiable_bies.includes(:user, :group, :role)
if abies.length > 0
if abies.present?
abies.each do |mod_rule|
p = {}
p[:user] = mod_rule.user.login if mod_rule.user
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
abies = @an.attrib_namespace_modifiable_bies.includes([:user, :group])
if abies.length > 0
if abies.present?
xml.namespace(:name => @an.name) do |an|
abies.each do |mod_rule|
p = {}
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/views/webui/feeds/commits.atom.builder
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ xml.feed(feed_opts) do |feed|
feed.link rel: 'self', type: 'application/atom+xml', href: request.url
title = "Commits for #{@project.name}"
feed.title(title)
feed.updated(@commits.first.datetime.iso8601) if @commits.length > 0
feed.updated(@commits.first.datetime.iso8601) if @commits.present?

@commits.each do |commit|
feed.entry do |entry|
Expand Down

0 comments on commit f8d00f2

Please sign in to comment.