# Cop supports --auto-correct.
Style/StringConcatenation:
Exclude:
- - 'app/helpers/browse_tags_helper.rb'
- - 'app/helpers/user_roles_helper.rb'
- - 'app/jobs/trace_importer_job.rb'
- - 'app/models/client_application.rb'
- - 'app/views/changesets/index.atom.builder'
- - 'lib/migrate.rb'
- - 'lib/potlatch.rb'
- - 'script/cleanup'
- - 'script/deliver-message'
- - 'script/statistics'
- - 'script/update-spam-blocks'
- - 'test/controllers/api/relations_controller_test.rb'
- 'test/helpers/user_roles_helper_test.rb'
# Contains a reference to a section of the wikipedia article
# Must break it up to correctly build the url
value = Regexp.last_match(1)
- section = "#" + Regexp.last_match(2)
- encoded_section = "#" + CGI.escape(Regexp.last_match(2).gsub(/ +/, "_")).tr("%", ".")
+ section = "##{Regexp.last_match(2)}"
+ encoded_section = "##{CGI.escape(Regexp.last_match(2).gsub(/ +/, '_')).tr('%', '.')}"
else
section = ""
encoded_section = ""
module UserRolesHelper
def role_icons(user)
UserRole::ALL_ROLES.reduce("".html_safe) do |acc, elem|
- acc + " " + role_icon(user, elem)
+ "#{acc} #{role_icon(user, elem)}"
end
end
rescue StandardError => e
logger.info e.to_s
e.backtrace.each { |l| logger.info l }
- UserMailer.gpx_failure(trace, e.to_s + "\n" + e.backtrace.join("\n")).deliver
+ UserMailer.gpx_failure(trace, "#{e}\n#{e.backtrace.join("\n")}").deliver
trace.destroy
end
end
end
def oauth_server
- @oauth_server ||= OAuth::Server.new("https://" + Settings.server_url)
+ @oauth_server ||= OAuth::Server.new("https://#{Settings.server_url}")
end
def credentials
lower_corner = "#{bbox.min_lat} #{bbox.min_lon}"
upper_corner = "#{bbox.max_lat} #{bbox.max_lon}"
- feed.georss :box, lower_corner + " " + upper_corner
+ feed.georss :box, "#{lower_corner} #{upper_corner}"
end
end
end
end
def add_primary_key(table_name, column_name, _options = {})
- execute "ALTER TABLE #{quote_table_name(table_name)} ADD PRIMARY KEY (#{quote_column_name(column_name)})"
+ table_name = quote_table_name(table_name)
+ column_name = quote_column_name(column_name)
+
+ execute "ALTER TABLE #{table_name} ADD PRIMARY KEY (#{column_name})"
end
def remove_primary_key(table_name)
- execute "ALTER TABLE #{quote_table_name(table_name)} DROP PRIMARY KEY"
+ table_name = quote_table_name(table_name)
+
+ execute "ALTER TABLE #{table_name} DROP PRIMARY KEY"
end
def alter_primary_key(table_name, new_columns)
- execute "ALTER TABLE #{quote_table_name(table_name)} DROP CONSTRAINT #{quote_table_name(table_name + '_pkey')}"
- execute "ALTER TABLE #{quote_table_name(table_name)} ADD PRIMARY KEY (#{quote_column_name(new_columns)})"
+ constraint_name = quote_table_name("#{table_name}_pkey")
+ table_name = quote_table_name(table_name)
+ new_columns = quote_column_name(new_columns)
+
+ execute "ALTER TABLE #{table_name} DROP CONSTRAINT #{constraint_name}"
+ execute "ALTER TABLE #{table_name} ADD PRIMARY KEY (#{new_columns})"
end
def create_enumeration(enumeration_name, values)
end
def rename_enumeration(old_name, new_name)
- execute "ALTER TYPE #{quote_table_name(old_name)} RENAME TO #{quote_table_name(new_name)}"
+ old_name = quote_table_name(old_name)
+ new_name = quote_table_name(new_name)
+
+ execute "ALTER TYPE #{old_name} RENAME TO #{new_name}"
end
end
end
# Envelope data into AMF writeable form
def self.putdata(index, n)
- d = encodestring(index + "/onResult")
+ d = encodestring("#{index}/onResult")
d += encodestring("null")
d += [-1].pack("N")
d += encodevalue(n)
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + "/../config/environment"
+require File.join(File.dirname(__FILE__), "..", "config", "environment")
UserToken.where("expiry < NOW()").delete_all
OauthNonce.where("timestamp < EXTRACT(EPOCH FROM NOW() - INTERVAL '1 day')").delete_all
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + "/../config/environment"
+require File.join(File.dirname(__FILE__), "..", "config", "environment")
if recipient = ARGV[0].match(/^c-(\d+)-(\d+)-(.*)$/)
comment = DiaryComment.find(recipient[1])
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + "/../config/environment"
+require File.join(File.dirname(__FILE__), "..", "config", "environment")
start_time = Time.now
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + "/../config/environment"
+require File.join(File.dirname(__FILE__), "..", "config", "environment")
require "generator"
addresses = User.count(
# create an relation with a node as member, this time test that we don't
# need a role attribute to be included
xml = "<osm><relation changeset='#{private_changeset.id}'>" \
- "<member ref='#{node.id}' type='node'/>" + "<tag k='test' v='yes' /></relation></osm>"
+ "<member ref='#{node.id}' type='node'/><tag k='test' v='yes' /></relation></osm>"
put relation_create_path, :params => xml, :headers => auth_header
# hope for forbidden due to user
assert_response :forbidden,
# create an relation with a node as member, this time test that we don't
# need a role attribute to be included
xml = "<osm><relation changeset='#{changeset.id}'>" \
- "<member ref='#{node.id}' type='node'/>" + "<tag k='test' v='yes' /></relation></osm>"
+ "<member ref='#{node.id}' type='node'/><tag k='test' v='yes' /></relation></osm>"
put relation_create_path, :params => xml, :headers => auth_header
# hope for success
assert_response :success,