Applies rubocop for ruby 2.3.1.

This commit is contained in:
Martin Edenhofer 2016-10-24 23:59:18 +02:00
parent 35a486f32b
commit 1ddbb5d59e
8 changed files with 12 additions and 12 deletions

View file

@ -602,7 +602,7 @@ class ApplicationController < ActionController::Base
per_page = 500
end
generic_objects = if offset > 0
generic_objects = if offset.positive?
object.limit(params[:per_page]).order(id: 'ASC').offset(offset).limit(limit)
else
object.all.order(id: 'ASC').offset(offset).limit(limit)

View file

@ -24,19 +24,19 @@ class FirstStepsController < ApplicationController
from_active = true
end
twitter_active = false
if Channel.where(area: 'Twitter::Account').count > 0
if Channel.where(area: 'Twitter::Account').count.positive?
twitter_active = true
end
facebook_active = false
if Channel.where(area: 'Facebook::Account').count > 0
if Channel.where(area: 'Facebook::Account').count.positive?
facebook_active = true
end
email_active = false
if Channel.where(area: 'Email::Account').count > 0
if Channel.where(area: 'Email::Account').count.positive?
email_active = true
end
text_module_active = false
if TextModule.count > 0
if TextModule.count.positive?
text_module_active = true
end
macro_active = false

View file

@ -236,7 +236,7 @@ returns
next if !item[:name]
attributes[assoc.name.to_s].push item[:name]
}
if ref.count > 0 && attributes[assoc.name.to_s].empty?
if ref.count.positive? && attributes[assoc.name.to_s].empty?
attributes.delete(assoc.name.to_s)
end
next

View file

@ -380,7 +380,7 @@ returns:
object_lookup_id: object_id,
o_id: o_id,
).count
return if count > 0
return if count.positive?
Avatar.create(
o_id: o_id,

View file

@ -100,7 +100,7 @@ class Job < ApplicationModel
def next_run_at_calculate(time = Time.zone.now)
if last_run_at
diff = time - last_run_at
if diff > 0
if diff.positive?
time = time + 10.minutes
end
end

View file

@ -27,7 +27,7 @@ class Karma::ActivityLog < ApplicationModel
end
local_score_total = score_total + activity.score
if local_score_total < 0
if local_score_total.negative?
local_score_total = 0
end

View file

@ -384,11 +384,11 @@ returns
end
list.each { |preferences|
next if preferences[:selectable] == false
Cache.write(key, true, expires_in: 20.seconds)
Cache.write(key, true, expires_in: 10.seconds)
return true
}
}
Cache.write(key, false, expires_in: 20.seconds)
Cache.write(key, false, expires_in: 10.seconds)
false
end

View file

@ -1085,7 +1085,7 @@ module Import::OTRS
# check if login is already used
login_in_use = User.where( "login = ? AND id != #{user_new[:id]}", user_new[:login].downcase ).count
if login_in_use > 0
if login_in_use.positive?
user_new[:login] = "#{user_new[:login]}_#{user_new[:id]}"
end