Corrected with rubocop cop 'Lint/StringConversionInInterpolation'.

This commit is contained in:
Thorsten Eckel 2015-05-06 11:30:39 +02:00
parent 0fc920df18
commit 650e17be7c
20 changed files with 39 additions and 41 deletions

View file

@ -234,8 +234,6 @@ Metrics/CyclomaticComplexity:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Lint/StringConversionInInterpolation:
Enabled: false
Style/GlobalVars:
Enabled: false
Rails/TimeZone:

View file

@ -70,7 +70,7 @@ returns
def self.param_cleanup(params, newObject = false)
if params == nil
raise "No params for #{self.to_s}!"
raise "No params for #{self}!"
end
# ignore id for new objects
@ -190,7 +190,7 @@ returns
if self.class.column_names.include? 'updated_by_id'
if UserInfo.current_user_id
if self.updated_by_id && self.updated_by_id != UserInfo.current_user_id
logger.info "NOTICE create - self.updated_by_id is different: #{self.updated_by_id.to_s}/#{UserInfo.current_user_id.to_s}"
logger.info "NOTICE create - self.updated_by_id is different: #{self.updated_by_id}/#{UserInfo.current_user_id}"
end
self.updated_by_id = UserInfo.current_user_id
end
@ -201,7 +201,7 @@ returns
return if !UserInfo.current_user_id
if self.created_by_id && self.created_by_id != UserInfo.current_user_id
logger.info "NOTICE create - self.created_by_id is different: #{self.created_by_id.to_s}/#{UserInfo.current_user_id.to_s}"
logger.info "NOTICE create - self.created_by_id is different: #{self.created_by_id}/#{UserInfo.current_user_id}"
end
self.created_by_id = UserInfo.current_user_id
end
@ -1082,7 +1082,7 @@ check string/varchar size and cut them if needed
if column && limit
current_length = attribute[1].to_s.length
if limit < current_length
logger.warn "WARNING: cut string because of database length #{self.class.to_s}.#{attribute[0]}(#{limit} but is #{current_length}:#{attribute[1].to_s})"
logger.warn "WARNING: cut string because of database length #{self.class}.#{attribute[0]}(#{limit} but is #{current_length}:#{attribute[1]})"
self[ attribute[0] ] = attribute[1][ 0, limit ]
end
end

View file

@ -72,7 +72,7 @@ class Channel::EmailParser
data[field.name.to_s.downcase.to_sym] = Encode.conv( 'utf8', field.to_s )
# if we need to access the lines by objects later again
data[ "raw-#{field.name.downcase.to_s}".to_sym ] = field
data[ "raw-#{field.name.downcase}".to_sym ] = field
end
}

View file

@ -60,7 +60,7 @@ class Channel::IMAP < Channel::EmailParser
message_ids.each do |message_id|
count += 1
Rails.logger.info " - message #{count.to_s}/#{count_all.to_s}"
Rails.logger.info " - message #{count}/#{count_all}"
#Rails.logger.info msg.to_s
# check for verify message

View file

@ -45,7 +45,7 @@ class Channel::POP3 < Channel::EmailParser
mails.each do |m|
count += 1
Rails.logger.info " - message #{count.to_s}/#{count_all.to_s}"
Rails.logger.info " - message #{count}/#{count_all}"
# check for verify message
if check_type == 'verify'

View file

@ -217,7 +217,7 @@ class Observer::Ticket::Notification::BackgroundJob
display = object_manager_attribute[:display].to_s
end
if object_manager_attribute && object_manager_attribute[:translate]
changes[display] = ["i18n(#{value_str[0].to_s})", "i18n(#{value_str[1].to_s})"]
changes[display] = ["i18n(#{value_str[0]})", "i18n(#{value_str[1]})"]
else
changes[display] = [value_str[0].to_s, value_str[1].to_s]
end

View file

@ -109,13 +109,13 @@ class Package < ApplicationModel
dest = @@root + '/' + file
if File.symlink?( dest.to_s )
logger.info "Unlink file: #{dest.to_s}"
logger.info "Unlink file: #{dest}"
File.delete( dest.to_s )
end
backup_file = dest.to_s + '.link_backup'
if File.exist?( backup_file )
logger.info "Restore backup file of #{backup_file} -> #{dest.to_s}."
logger.info "Restore backup file of #{backup_file} -> #{dest}."
File.rename( backup_file, dest.to_s )
end
end
@ -146,7 +146,7 @@ class Package < ApplicationModel
if File.directory?( entry.to_s )
if !File.exist?( dest.to_s )
logger.info "Create dir: #{dest.to_s}"
logger.info "Create dir: #{dest}"
FileUtils.mkdir_p( dest.to_s )
end
end
@ -154,9 +154,9 @@ class Package < ApplicationModel
if File.file?( entry.to_s ) && ( File.file?( dest.to_s ) && !File.symlink?( dest.to_s ) )
backup_file = dest.to_s + '.link_backup'
if File.exist?( backup_file )
raise "Can't link #{entry.to_s} -> #{dest.to_s}, destination and .link_backup already exists!"
raise "Can't link #{entry} -> #{dest}, destination and .link_backup already exists!"
else
logger.info "Create backup file of #{dest.to_s} -> #{backup_file}."
logger.info "Create backup file of #{dest} -> #{backup_file}."
File.rename( dest.to_s, backup_file )
end
end
@ -165,7 +165,7 @@ class Package < ApplicationModel
if File.symlink?( dest.to_s )
File.delete( dest.to_s )
end
logger.info "Link file: #{entry.to_s} -> #{dest.to_s}"
logger.info "Link file: #{entry} -> #{dest}"
File.symlink( entry.to_s, dest.to_s )
end
end

View file

@ -99,7 +99,7 @@ class Scheduler < ApplicationModel
def self.worker
wait = 10
logger.info "*** Starting worker #{Delayed::Job.to_s}"
logger.info "*** Starting worker #{Delayed::Job}"
loop do
result = nil
@ -135,14 +135,14 @@ class Scheduler < ApplicationModel
exit 2
end
if scheduler.last_run < time_critical_time
puts "CRITICAL - scheduler jobs was not running in last '#{time_critical.to_s}' minutes - last run at '#{scheduler.last_run.to_s}' '#{name}'"
puts "CRITICAL - scheduler jobs was not running in last '#{time_critical}' minutes - last run at '#{scheduler.last_run}' '#{name}'"
exit 2
end
if scheduler.last_run < time_warning_time
puts "CRITICAL - scheduler jobs was not running in last '#{time_warning.to_s}' minutes - last run at '#{scheduler.last_run.to_s}' '#{name}'"
puts "CRITICAL - scheduler jobs was not running in last '#{time_warning}' minutes - last run at '#{scheduler.last_run}' '#{name}'"
exit 2
end
puts "ok - scheduler jobs was running at '#{scheduler.last_run.to_s}' '#{name}'"
puts "ok - scheduler jobs was running at '#{scheduler.last_run}' '#{name}'"
exit 0
end
end

View file

@ -22,7 +22,7 @@ module Auth::Ldap
return
end
rescue Exception => e
Rails.logger.info "Can't connect to '#{config[:host]}', #{e.to_s}"
Rails.logger.info "Can't connect to '#{config[:host]}', #{e}"
return
end

View file

@ -21,7 +21,7 @@ returns
def self.setup
auto_wizard_file_name = 'auto_wizard.json'
auto_wizard_file_name = "#{Rails.root.to_s}/#{auto_wizard_file_name}"
auto_wizard_file_name = "#{Rails.root}/#{auto_wizard_file_name}"
return if !File.file?(auto_wizard_file_name)

View file

@ -25,7 +25,7 @@ class GeoIp::ZammadGeoIp
},
)
if !response.success? && response.code.to_s !~ /^40.$/
raise "ERROR: #{response.code.to_s}/#{response.body}"
raise "ERROR: #{response.code}/#{response.body}"
end
data = response.data

View file

@ -89,7 +89,7 @@ add new object to search index
password: Setting.get('es_password'),
}
)
Rails.logger.info "# #{response.code.to_s}"
Rails.logger.info "# #{response.code}"
return true if response.success?
raise response.inspect
end
@ -208,7 +208,7 @@ return search result
}
)
Rails.logger.info "# #{response.code.to_s}"
Rails.logger.info "# #{response.code}"
if !response.success?
Rails.logger.error "ERROR: #{response.inspect}"
return []
@ -220,7 +220,7 @@ return search result
return ids if !data['hits']
return ids if !data['hits']['hits']
data['hits']['hits'].each { |item|
Rails.logger.info "... #{item['_type'].to_s} #{item['_id'].to_s}"
Rails.logger.info "... #{item['_type']} #{item['_id']}"
data = {
id: item['_id'],
type: item['_type'],

View file

@ -16,7 +16,7 @@ class Sessions::Backend::Collections::Base
end
def client_key
"collections::load::#{ self.class.to_s }::#{ @user.id }::#{ @client_id }"
"collections::load::#{ self.class }::#{ @user.id }::#{ @client_id }"
end
def push
@ -77,13 +77,13 @@ class Sessions::Backend::Collections::Base
assets: assets,
}
end
@client.log "push assets for push_collection #{ items.first.class.to_s } for user #{ @user.id }"
@client.log "push assets for push_collection #{ items.first.class } for user #{ @user.id }"
@client.send(
data: assets,
event: [ 'loadAssets' ],
)
@client.log "push push_collection #{ items.first.class.to_s } for user #{ @user.id }"
@client.log "push push_collection #{ items.first.class } for user #{ @user.id }"
@client.send(
event: 'resetCollection',
data: {

View file

@ -10,7 +10,7 @@ class Sessions::Backend::Rss
end
def collection_key
"rss::load::#{ self.class.to_s }::#{ @user.id }"
"rss::load::#{ self.class }::#{ @user.id }"
end
def load
@ -29,7 +29,7 @@ class Sessions::Backend::Rss
end
def client_key
"rss::load::#{ self.class.to_s }::#{ @user.id }::#{ @client_id }"
"rss::load::#{ self.class }::#{ @user.id }::#{ @client_id }"
end
def push

View file

@ -27,7 +27,7 @@ class Sessions::Backend::TicketCreate
end
def client_key
"as::load::#{ self.class.to_s }::#{ @user.id }::#{ @client_id }"
"as::load::#{ self.class }::#{ @user.id }::#{ @client_id }"
end
def push

View file

@ -28,7 +28,7 @@ class Sessions::Backend::TicketOverviewIndex
end
def client_key
"as::load::#{ self.class.to_s }::#{ @user.id }::#{ @client_id }"
"as::load::#{ self.class }::#{ @user.id }::#{ @client_id }"
end
def push

View file

@ -39,7 +39,7 @@ class Sessions::Backend::TicketOverviewList
end
def client_key
"as::load::#{ self.class.to_s }::#{ @user.id }::#{ @client_id }"
"as::load::#{ self.class }::#{ @user.id }::#{ @client_id }"
end
def push

View file

@ -76,7 +76,7 @@ module StaticAssets
return if !file
hash = Digest::MD5.hexdigest( file.content )
path = "#{Rails.root.to_s}/public/assets/images/#{hash}"
path = "#{Rails.root}/public/assets/images/#{hash}"
File.open( path, 'wb' ) do |f|
f.puts file.content
end

View file

@ -283,7 +283,7 @@ returns
def self.process(response, uri, count, params, options)
if !response
return Result.new(
error: "Can't connect to #{uri.to_s}, got no response!",
error: "Can't connect to #{uri}, got no response!",
success: false,
code: 0,
)
@ -292,7 +292,7 @@ returns
case response
when Net::HTTPNotFound
return Result.new(
error: "No such file #{uri.to_s}, 404!",
error: "No such file #{uri}, 404!",
success: false,
code: response.code,
)

View file

@ -58,7 +58,7 @@ if ARGV[0] != 'start' && ARGV[0] != 'stop'
exit
end
puts "Starting websocket server on #{ @options[:b] }:#{ @options[:p] } (secure:#{ @options[:s].to_s },pid:#{@options[:i].to_s})"
puts "Starting websocket server on #{ @options[:b] }:#{ @options[:p] } (secure:#{ @options[:s] },pid:#{@options[:i]})"
#puts options.inspect
if ARGV[0] == 'stop'
@ -139,7 +139,7 @@ EventMachine.run {
# error handling
if data['timestamp']
log 'notice', "request spool data > '#{Time.at(data['timestamp']).to_s}'", client_id
log 'notice', "request spool data > '#{Time.at(data['timestamp'])}'", client_id
else
log 'notice', 'request spool with init data', client_id
end
@ -199,7 +199,7 @@ EventMachine.run {
else
data['recipient']['user_id'].each { |user_id|
if local_client[:user]['id'].to_i == user_id.to_i
log 'notice', "send broadcast from (#{client_id.to_s}) to (user_id=#{user_id})", local_client_id
log 'notice', "send broadcast from (#{client_id}) to (user_id=#{user_id})", local_client_id
if local_client[:meta][:type] == 'websocket' && @clients[ local_client_id ]
@clients[ local_client_id ][:websocket].send( "[#{msg}]" )
else
@ -213,7 +213,7 @@ EventMachine.run {
# broadcast every client
else
log 'notice', "send broadcast from (#{client_id.to_s})", local_client_id
log 'notice', "send broadcast from (#{client_id})", local_client_id
if local_client[:meta][:type] == 'websocket' && @clients[ local_client_id ]
@clients[ local_client_id ][:websocket].send( "[#{msg}]" )
else