Fix new rubocopy warnings
This commit is contained in:
parent
7ce77006fa
commit
c9d35839be
30 changed files with 173 additions and 102 deletions
|
@ -6,6 +6,9 @@ AllCops:
|
|||
Style/BracesAroundHashParameters:
|
||||
EnforcedStyle: context_dependent
|
||||
|
||||
Style/ExtraSpacing:
|
||||
AllowForAlignment: true
|
||||
|
||||
Style/FileName:
|
||||
Exclude:
|
||||
- 'script/deliver-message'
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# This configuration was generated by `rubocop --auto-gen-config`
|
||||
# on 2015-06-08 15:55:30 +0100 using RuboCop version 0.32.0.
|
||||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2015-08-18 20:27:49 +0100 using RuboCop version 0.33.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
|
@ -7,26 +8,54 @@
|
|||
|
||||
# Offense count: 34
|
||||
Lint/AmbiguousOperator:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'test/controllers/amf_controller_test.rb'
|
||||
- 'test/controllers/changeset_controller_test.rb'
|
||||
- 'test/lib/bounding_box_test.rb'
|
||||
- 'test/lib/country_test.rb'
|
||||
|
||||
# Offense count: 115
|
||||
Lint/AmbiguousRegexpLiteral:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 30
|
||||
# Offense count: 29
|
||||
# Configuration parameters: AllowSafeAssignment.
|
||||
Lint/AssignmentInCondition:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'app/controllers/application_controller.rb'
|
||||
- 'app/controllers/geocoder_controller.rb'
|
||||
- 'app/controllers/notes_controller.rb'
|
||||
- 'app/controllers/trace_controller.rb'
|
||||
- 'app/controllers/user_controller.rb'
|
||||
- 'app/controllers/user_preference_controller.rb'
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'app/helpers/browse_helper.rb'
|
||||
- 'app/models/client_application.rb'
|
||||
- 'app/models/notifier.rb'
|
||||
- 'lib/nominatim.rb'
|
||||
- 'lib/osm.rb'
|
||||
- 'script/deliver-message'
|
||||
|
||||
# Offense count: 3
|
||||
Lint/FormatParameterMismatch:
|
||||
Exclude:
|
||||
- 'app/controllers/swf_controller.rb'
|
||||
|
||||
# Offense count: 5
|
||||
Lint/HandleExceptions:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'app/controllers/amf_controller.rb'
|
||||
- 'app/controllers/user_controller.rb'
|
||||
- 'config/initializers/session.rb'
|
||||
|
||||
# Offense count: 8
|
||||
Lint/ParenthesesAsGroupedExpression:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'test/controllers/amf_controller_test.rb'
|
||||
- 'test/lib/bounding_box_test.rb'
|
||||
- 'test/models/user_preference_test.rb'
|
||||
|
||||
# Offense count: 669
|
||||
# Offense count: 671
|
||||
Metrics/AbcSize:
|
||||
Max: 277
|
||||
|
||||
|
@ -43,12 +72,12 @@ Metrics/ClassLength:
|
|||
Metrics/CyclomaticComplexity:
|
||||
Max: 20
|
||||
|
||||
# Offense count: 2537
|
||||
# Offense count: 2535
|
||||
# Configuration parameters: AllowURI, URISchemes.
|
||||
Metrics/LineLength:
|
||||
Max: 694
|
||||
|
||||
# Offense count: 623
|
||||
# Offense count: 628
|
||||
# Configuration parameters: CountComments.
|
||||
Metrics/MethodLength:
|
||||
Max: 179
|
||||
|
@ -70,34 +99,65 @@ Metrics/PerceivedComplexity:
|
|||
# Offense count: 2
|
||||
# Configuration parameters: Include.
|
||||
Rails/HasAndBelongsToMany:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'app/models/changeset.rb'
|
||||
- 'app/models/user.rb'
|
||||
|
||||
# Offense count: 67
|
||||
# Offense count: 66
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Rails/TimeZone:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 5
|
||||
Style/AccessorMethodName:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'app/controllers/application_controller.rb'
|
||||
- 'app/helpers/title_helper.rb'
|
||||
- 'app/models/old_way.rb'
|
||||
- 'lib/osm.rb'
|
||||
- 'lib/potlatch.rb'
|
||||
|
||||
# Offense count: 1
|
||||
Style/AsciiComments:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'test/models/message_test.rb'
|
||||
|
||||
# Offense count: 308
|
||||
# Offense count: 310
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 38
|
||||
# Configuration parameters: MinBodyLength.
|
||||
Style/GuardClause:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'app/controllers/application_controller.rb'
|
||||
- 'app/controllers/diary_entry_controller.rb'
|
||||
- 'app/controllers/message_controller.rb'
|
||||
- 'app/controllers/notes_controller.rb'
|
||||
- 'app/controllers/site_controller.rb'
|
||||
- 'app/controllers/user_blocks_controller.rb'
|
||||
- 'app/controllers/user_controller.rb'
|
||||
- 'app/controllers/user_roles_controller.rb'
|
||||
- 'app/helpers/application_helper.rb'
|
||||
- 'app/models/changeset.rb'
|
||||
- 'app/models/user.rb'
|
||||
- 'lib/diff_reader.rb'
|
||||
- 'lib/object_metadata.rb'
|
||||
|
||||
# Offense count: 60
|
||||
# Cop supports --auto-correct.
|
||||
Style/LineEndConcatenation:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'db/migrate/008_remove_segments.rb'
|
||||
- 'db/migrate/020_populate_node_tags_and_remove.rb'
|
||||
- 'db/migrate/023_add_changesets.rb'
|
||||
- 'lib/bounding_box.rb'
|
||||
- 'lib/diff_reader.rb'
|
||||
- 'lib/osm.rb'
|
||||
- 'test/controllers/changeset_controller_test.rb'
|
||||
- 'test/controllers/node_controller_test.rb'
|
||||
- 'test/controllers/relation_controller_test.rb'
|
||||
- 'test/controllers/way_controller_test.rb'
|
||||
|
||||
# Offense count: 69
|
||||
# Cop supports --auto-correct.
|
||||
|
@ -107,12 +167,25 @@ Style/NumericLiterals:
|
|||
# Offense count: 42
|
||||
# Cop supports --auto-correct.
|
||||
Style/PerlBackrefs:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'app/controllers/amf_controller.rb'
|
||||
- 'app/controllers/application_controller.rb'
|
||||
- 'app/helpers/browse_helper.rb'
|
||||
- 'config/initializers/paperclip.rb'
|
||||
- 'lib/id.rb'
|
||||
- 'lib/potlatch.rb'
|
||||
- 'test/lib/i18n_test.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Configuration parameters: NamePrefix, NamePrefixBlacklist.
|
||||
Style/PredicateName:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'app/models/changeset.rb'
|
||||
- 'app/models/old_node.rb'
|
||||
- 'app/models/old_relation.rb'
|
||||
- 'app/models/old_way.rb'
|
||||
- 'app/models/user.rb'
|
||||
- 'lib/classic_pagination/pagination.rb'
|
||||
|
||||
# Offense count: 97
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
|
@ -121,16 +194,11 @@ Style/RaiseArgs:
|
|||
|
||||
# Offense count: 2
|
||||
Style/RescueModifier:
|
||||
Enabled: false
|
||||
Exclude:
|
||||
- 'app/helpers/browse_helper.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/StringLiteralsInInterpolation:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist.
|
||||
Style/TrivialAccessors:
|
||||
Enabled: false
|
||||
|
|
|
@ -98,7 +98,7 @@ class AmfController < ApplicationController
|
|||
result = startchangeset(*args)
|
||||
end
|
||||
|
||||
err = true if result[0] == -3 # If a conflict is detected, don't execute any more writes
|
||||
err = true if result[0] == -3 # If a conflict is detected, don't execute any more writes
|
||||
end
|
||||
|
||||
result
|
||||
|
@ -527,7 +527,7 @@ class AmfController < ApplicationController
|
|||
# 3. version.
|
||||
|
||||
def putrelation(renumberednodes, renumberedways, usertoken, changeset_id, version, relid, tags, members, visible) #:doc:
|
||||
amf_handle_error("'putrelation' #{relid}", "relation", relid) do
|
||||
amf_handle_error("'putrelation' #{relid}", "relation", relid) do
|
||||
user = getuser(usertoken)
|
||||
|
||||
return -1, "You are not logged in, so the relation could not be saved." unless user
|
||||
|
@ -645,7 +645,7 @@ class AmfController < ApplicationController
|
|||
return -2, "Server error - node with id 0 found in way #{originalway}." if id == 0
|
||||
return -2, "Server error - node with latitude -90 found in way #{originalway}." if lat == 90
|
||||
|
||||
id = renumberednodes[id] if renumberednodes[id]
|
||||
id = renumberednodes[id] if renumberednodes[id]
|
||||
|
||||
node = Node.new
|
||||
node.changeset_id = changeset_id
|
||||
|
|
|
@ -448,11 +448,11 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# extract authorisation credentials from headers, returns user = nil if none
|
||||
def get_auth_data
|
||||
if request.env.key? "X-HTTP_AUTHORIZATION" # where mod_rewrite might have put it
|
||||
if request.env.key? "X-HTTP_AUTHORIZATION" # where mod_rewrite might have put it
|
||||
authdata = request.env["X-HTTP_AUTHORIZATION"].to_s.split
|
||||
elsif request.env.key? "REDIRECT_X_HTTP_AUTHORIZATION" # mod_fcgi
|
||||
elsif request.env.key? "REDIRECT_X_HTTP_AUTHORIZATION" # mod_fcgi
|
||||
authdata = request.env["REDIRECT_X_HTTP_AUTHORIZATION"].to_s.split
|
||||
elsif request.env.key? "HTTP_AUTHORIZATION" # regular location
|
||||
elsif request.env.key? "HTTP_AUTHORIZATION" # regular location
|
||||
authdata = request.env["HTTP_AUTHORIZATION"].to_s.split
|
||||
end
|
||||
# only basic authentication supported
|
||||
|
|
|
@ -456,7 +456,7 @@ class ChangesetController < ApplicationController
|
|||
# restrict changesets to those enclosed by a bounding box
|
||||
# we need to return both the changesets and the bounding box
|
||||
def conditions_bbox(changesets, bbox)
|
||||
if bbox
|
||||
if bbox
|
||||
bbox.check_boundaries
|
||||
bbox = bbox.to_scaled
|
||||
return changesets.where("min_lon < ? and max_lon > ? and min_lat < ? and max_lat > ?",
|
||||
|
|
|
@ -98,7 +98,7 @@ class GeocoderController < ApplicationController
|
|||
unless response.match(/Error/)
|
||||
dataline = response.split(/\n/)[1]
|
||||
data = dataline.split(/,/) # easting,northing,postcode,lat,long
|
||||
postcode = data[2].gsub(/'/, "")
|
||||
postcode = data[2].delete("'")
|
||||
zoom = POSTCODE_ZOOM - postcode.count("#")
|
||||
@results.push(:lat => data[3], :lon => data[4], :zoom => zoom,
|
||||
:name => postcode)
|
||||
|
@ -174,7 +174,7 @@ class GeocoderController < ApplicationController
|
|||
if type.empty?
|
||||
prefix_name = ""
|
||||
else
|
||||
prefix_name = t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.gsub("_", " ").capitalize
|
||||
prefix_name = t "geocoder.search_osm_nominatim.prefix.#{klass}.#{type}", :default => type.tr("_", " ").capitalize
|
||||
end
|
||||
if klass == "boundary" && type == "administrative"
|
||||
rank = (place.attributes["place_rank"].to_i + 1) / 2
|
||||
|
|
|
@ -278,8 +278,8 @@ class NotesController < ApplicationController
|
|||
def mine
|
||||
if params[:display_name]
|
||||
if @this_user = User.active.find_by_display_name(params[:display_name])
|
||||
@title = t "note.mine.title", :user => @this_user.display_name
|
||||
@heading = t "note.mine.heading", :user => @this_user.display_name
|
||||
@title = t "note.mine.title", :user => @this_user.display_name
|
||||
@heading = t "note.mine.heading", :user => @this_user.display_name
|
||||
@description = t "note.mine.subheading", :user => render_to_string(:partial => "user", :object => @this_user)
|
||||
@page = (params[:page] || 1).to_i
|
||||
@page_size = 10
|
||||
|
|
|
@ -31,7 +31,7 @@ class SwfController < ApplicationController
|
|||
bounds_top = 240 * 20
|
||||
|
||||
m = ""
|
||||
m += swf_record(9, 255.chr + 155.chr + 155.chr) # Background
|
||||
m += swf_record(9, 255.chr + 155.chr + 155.chr) # Background
|
||||
absx = 0
|
||||
absy = 0
|
||||
xl = yb = 9999999
|
||||
|
@ -47,7 +47,7 @@ class SwfController < ApplicationController
|
|||
user = User.authenticate(:token => params[:token])
|
||||
sql = "SELECT gps_points.latitude*0.0000001 AS lat,gps_points.longitude*0.0000001 AS lon,gpx_files.id AS fileid," + " EXTRACT(EPOCH FROM gps_points.timestamp) AS ts, gps_points.trackid AS trackid " + " FROM gpx_files,gps_points " + "WHERE gpx_files.id=gpx_id " + " AND gpx_files.user_id=#{user.id} " + " AND " + OSM.sql_for_area(bbox, "gps_points.") + " AND (gps_points.timestamp IS NOT NULL) " + "ORDER BY fileid DESC,ts " + "LIMIT 10000 OFFSET #{start}"
|
||||
else
|
||||
sql = "SELECT latitude*0.0000001 AS lat,longitude*0.0000001 AS lon,gpx_id AS fileid," + " EXTRACT(EPOCH FROM timestamp) AS ts, gps_points.trackid AS trackid " + " FROM gps_points " + "WHERE " + OSM.sql_for_area(bbox, "gps_points.") + " AND (gps_points.timestamp IS NOT NULL) " + "ORDER BY fileid DESC,ts " + "LIMIT 10000 OFFSET #{start}"
|
||||
sql = "SELECT latitude*0.0000001 AS lat,longitude*0.0000001 AS lon,gpx_id AS fileid," + " EXTRACT(EPOCH FROM timestamp) AS ts, gps_points.trackid AS trackid " + " FROM gps_points " + "WHERE " + OSM.sql_for_area(bbox, "gps_points.") + " AND (gps_points.timestamp IS NOT NULL) " + "ORDER BY fileid DESC,ts " + "LIMIT 10000 OFFSET #{start}"
|
||||
end
|
||||
gpslist = ActiveRecord::Base.connection.select_all sql
|
||||
|
||||
|
@ -104,11 +104,11 @@ class SwfController < ApplicationController
|
|||
# Line-drawing
|
||||
|
||||
def start_shape
|
||||
s = 0.chr # No fill styles
|
||||
s += 2.chr # Two line styles
|
||||
s += pack_u16(0) + 0.chr + 255.chr + 255.chr # Width 5, RGB #00FFFF
|
||||
s += pack_u16(0) + 255.chr + 0.chr + 255.chr # Width 5, RGB #FF00FF
|
||||
s += 34.chr # 2 fill, 2 line index bits
|
||||
s = 0.chr # No fill styles
|
||||
s += 2.chr # Two line styles
|
||||
s += pack_u16(0) + 0.chr + 255.chr + 255.chr # Width 5, RGB #00FFFF
|
||||
s += pack_u16(0) + 255.chr + 0.chr + 255.chr # Width 5, RGB #FF00FF
|
||||
s += 34.chr # 2 fill, 2 line index bits
|
||||
s
|
||||
end
|
||||
|
||||
|
@ -117,10 +117,10 @@ class SwfController < ApplicationController
|
|||
end
|
||||
|
||||
def start_and_move(x, y, col)
|
||||
d = "001001" # Line style change, moveTo
|
||||
d = "001001" # Line style change, moveTo
|
||||
l = [length_sb(x), length_sb(y)].max
|
||||
d += format("%05b%0*b%0*b", l, l, x, l, y)
|
||||
d += col # Select line style
|
||||
d += col # Select line style
|
||||
d
|
||||
end
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ class TraceController < ApplicationController
|
|||
def icon
|
||||
trace = Trace.find(params[:id])
|
||||
|
||||
if trace.visible? && trace.inserted?
|
||||
if trace.visible? && trace.inserted?
|
||||
if trace.public? || (@user && @user == trace.user)
|
||||
expires_in 7.days, :private => !trace.public?, :public => trace.public?
|
||||
send_file(trace.icon_picture_name, :filename => "#{trace.id}_icon.gif", :type => "image/gif", :disposition => "inline")
|
||||
|
|
|
@ -625,7 +625,7 @@ class UserController < ApplicationController
|
|||
def failed_login(message)
|
||||
flash[:error] = message
|
||||
|
||||
redirect_to :action => "login", :referer => session[:referer]
|
||||
redirect_to :action => "login", :referer => session[:referer]
|
||||
|
||||
session.delete(:remember_me)
|
||||
session.delete(:referer)
|
||||
|
|
|
@ -122,7 +122,7 @@ module BrowseHelper
|
|||
if value =~ /^([a-z-]{2,12}):(.+)$/i
|
||||
# Value is <lang>:<title> so split it up
|
||||
# Note that value is always left as-is, see: https://trac.openstreetmap.org/ticket/4315
|
||||
lang = $1
|
||||
lang = $1
|
||||
else
|
||||
# Value is <title> so default to English Wikipedia
|
||||
lang = "en"
|
||||
|
@ -140,7 +140,7 @@ module BrowseHelper
|
|||
# Must break it up to correctly build the url
|
||||
value = $1
|
||||
section = "#" + $2
|
||||
encoded_section = "#" + URI.encode($2.gsub(/ +/, "_"), /[^A-Za-z0-9:_]/).gsub("%", ".")
|
||||
encoded_section = "#" + URI.encode($2.gsub(/ +/, "_"), /[^A-Za-z0-9:_]/).tr("%", ".")
|
||||
else
|
||||
section = ""
|
||||
encoded_section = ""
|
||||
|
|
|
@ -108,7 +108,7 @@ class Notifier < ActionMailer::Base
|
|||
:title => "Re: #{comment.diary_entry.title}")
|
||||
|
||||
mail :from => from_address(comment.user.display_name, "c", comment.id, comment.digest),
|
||||
:to => comment.diary_entry.user.email,
|
||||
:to => comment.diary_entry.user.email,
|
||||
:subject => I18n.t("notifier.diary_comment_notification.subject", :user => comment.user.display_name)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class User < ActiveRecord::Base
|
|||
has_many :tokens, :class_name => "UserToken"
|
||||
has_many :preferences, :class_name => "UserPreference"
|
||||
has_many :changesets, -> { order(:created_at => :desc) }
|
||||
has_many :changeset_comments, :foreign_key => :author_id
|
||||
has_many :changeset_comments, :foreign_key => :author_id
|
||||
has_and_belongs_to_many :changeset_subscriptions, :class_name => "Changeset", :join_table => "changesets_subscribers", :foreign_key => "subscriber_id"
|
||||
has_many :note_comments, :foreign_key => :author_id
|
||||
has_many :notes, :through => :note_comments
|
||||
|
|
|
@ -31,8 +31,8 @@ class PopulateNodeTagsAndRemove < ActiveRecord::Migration
|
|||
|
||||
create_table :current_node_tags, :id => false do |t|
|
||||
t.column :id, :bigint, :null => false
|
||||
t.column :k, :string, :default => "", :null => false
|
||||
t.column :v, :string, :default => "", :null => false
|
||||
t.column :k, :string, :default => "", :null => false
|
||||
t.column :v, :string, :default => "", :null => false
|
||||
end
|
||||
|
||||
create_table :node_tags, :id => false do |t|
|
||||
|
|
|
@ -4,7 +4,7 @@ class CreateChangesetComments < ActiveRecord::Migration
|
|||
def change
|
||||
create_table :changeset_comments do |t|
|
||||
t.column :changeset_id, :bigint, :null => false
|
||||
t.column :author_id, :bigint, :null => false
|
||||
t.column :author_id, :bigint, :null => false
|
||||
t.text :body, :null => false
|
||||
t.timestamp :created_at, :null => false
|
||||
t.boolean :visible, :null => false
|
||||
|
|
|
@ -57,7 +57,7 @@ class DiffReader
|
|||
# care of that for us.
|
||||
if @reader.node_type == 1 # element
|
||||
name = @reader.name
|
||||
attributes = {}
|
||||
attributes = {}
|
||||
|
||||
if @reader.has_attributes?
|
||||
while @reader.move_to_next_attribute == 1
|
||||
|
|
|
@ -498,7 +498,7 @@ module OSM
|
|||
root["generator"] = GENERATOR
|
||||
root["copyright"] = COPYRIGHT_OWNER
|
||||
root["attribution"] = ATTRIBUTION_URL
|
||||
root["license"] = LICENSE_URL
|
||||
root["license"] = LICENSE_URL
|
||||
doc.root = root
|
||||
doc
|
||||
end
|
||||
|
|
|
@ -24,7 +24,7 @@ module Potlatch
|
|||
|
||||
# Return eight-byte double-precision float
|
||||
def self.getdouble(s)
|
||||
a = s.read(8).unpack("G") # G big-endian, E little-endian
|
||||
a = s.read(8).unpack("G") # G big-endian, E little-endian
|
||||
a[0]
|
||||
end
|
||||
|
||||
|
@ -42,23 +42,23 @@ module Potlatch
|
|||
break if key == ""
|
||||
arr[key] = getvalue(s)
|
||||
end
|
||||
s.getbyte # skip the 9 'end of object' value
|
||||
s.getbyte # skip the 9 'end of object' value
|
||||
arr
|
||||
end
|
||||
|
||||
# Parse and get value
|
||||
def self.getvalue(s)
|
||||
case s.getbyte
|
||||
when 0 then return getdouble(s) # number
|
||||
when 1 then return s.getbyte # boolean
|
||||
when 2 then return getstring(s) # string
|
||||
when 3 then return getobject(s) # object/hash
|
||||
when 5 then return nil # null
|
||||
when 6 then return nil # undefined
|
||||
when 8 then s.read(4) # mixedArray
|
||||
return getobject(s) # |
|
||||
when 10 then return getarray(s) # array
|
||||
else return nil # error
|
||||
when 0 then return getdouble(s) # number
|
||||
when 1 then return s.getbyte # boolean
|
||||
when 2 then return getstring(s) # string
|
||||
when 3 then return getobject(s) # object/hash
|
||||
when 5 then return nil # null
|
||||
when 6 then return nil # undefined
|
||||
when 8 then s.read(4) # mixedArray
|
||||
return getobject(s) # |
|
||||
when 10 then return getarray(s) # array
|
||||
else return nil # error
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ module ShortLink
|
|||
# keep support for old shortlinks which use the @ character, now
|
||||
# replaced by the ~ character because twitter is horribly broken
|
||||
# and we can't have that.
|
||||
str.gsub!("@", "~")
|
||||
str.tr!("@", "~")
|
||||
|
||||
str.each_char do |c|
|
||||
t = ARRAY.index c
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace "db" do
|
||||
desc "Adds a version number to the nodes table"
|
||||
task :node_version do
|
||||
task :node_version do
|
||||
require File.dirname(__FILE__) + "/../../config/environment"
|
||||
|
||||
increment = 1000
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env ruby
|
||||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||
|
||||
APP_PATH = File.expand_path("../../config/application", __FILE__)
|
||||
require File.expand_path("../../config/boot", __FILE__)
|
||||
APP_PATH = File.expand_path("../../config/application", __FILE__)
|
||||
require File.expand_path("../../config/boot", __FILE__)
|
||||
require "rails/commands"
|
||||
|
|
|
@ -1358,24 +1358,24 @@ class AmfControllerTest < ActionController::TestCase
|
|||
def amf_parse_response
|
||||
req = StringIO.new(@response.body)
|
||||
|
||||
req.read(2) # version
|
||||
req.read(2) # version
|
||||
|
||||
# parse through any headers
|
||||
headers = AMF.getint(req) # Read number of headers
|
||||
headers.times do # Read each header
|
||||
AMF.getstring(req) # |
|
||||
req.getc # | skip boolean
|
||||
AMF.getvalue(req) # |
|
||||
headers = AMF.getint(req) # Read number of headers
|
||||
headers.times do # Read each header
|
||||
AMF.getstring(req) # |
|
||||
req.getc # | skip boolean
|
||||
AMF.getvalue(req) # |
|
||||
end
|
||||
|
||||
# parse through responses
|
||||
results = {}
|
||||
bodies = AMF.getint(req) # Read number of bodies
|
||||
bodies.times do # Read each body
|
||||
message = AMF.getstring(req) # | get message name
|
||||
AMF.getstring(req) # | get index in response sequence
|
||||
AMF.getlong(req) # | get total size in bytes
|
||||
args = AMF.getvalue(req) # | get response (probably an array)
|
||||
bodies = AMF.getint(req) # Read number of bodies
|
||||
bodies.times do # Read each body
|
||||
message = AMF.getstring(req) # | get message name
|
||||
AMF.getstring(req) # | get index in response sequence
|
||||
AMF.getlong(req) # | get total size in bytes
|
||||
args = AMF.getvalue(req) # | get response (probably an array)
|
||||
results[message] = args
|
||||
end
|
||||
@amf_result = results
|
||||
|
|
|
@ -385,7 +385,7 @@ class ApiControllerTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def test_permissions_oauth
|
||||
@request.env["oauth.token"] = AccessToken.new do |token|
|
||||
@request.env["oauth.token"] = AccessToken.new do |token|
|
||||
# Just to test a few
|
||||
token.allow_read_prefs = true
|
||||
token.allow_write_api = true
|
||||
|
|
|
@ -1477,12 +1477,12 @@ EOF
|
|||
# NOTE: the include method doesn't over-expand, like inserting
|
||||
# a real method does. this is because we expect the client to
|
||||
# know what it is doing!
|
||||
check_after_include(changeset_id, 1, 1, [1, 1, 1, 1])
|
||||
check_after_include(changeset_id, 3, 3, [1, 1, 3, 3])
|
||||
check_after_include(changeset_id, 4, 2, [1, 1, 4, 3])
|
||||
check_after_include(changeset_id, 2, 2, [1, 1, 4, 3])
|
||||
check_after_include(changeset_id, -1, -1, [-1, -1, 4, 3])
|
||||
check_after_include(changeset_id, -2, 5, [-2, -1, 4, 5])
|
||||
check_after_include(changeset_id, 1, 1, [1, 1, 1, 1])
|
||||
check_after_include(changeset_id, 3, 3, [1, 1, 3, 3])
|
||||
check_after_include(changeset_id, 4, 2, [1, 1, 4, 3])
|
||||
check_after_include(changeset_id, 2, 2, [1, 1, 4, 3])
|
||||
check_after_include(changeset_id, -1, -1, [-1, -1, 4, 3])
|
||||
check_after_include(changeset_id, -2, 5, [-2, -1, 4, 5])
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -446,7 +446,7 @@ class GeocoderControllerTest < ActionController::TestCase
|
|||
xhr :get, :search_osm_nominatim_reverse, :lat => 51.7632, :lon => -0.0076, :zoom => 17
|
||||
results_check :name => "Dinant Link Road, Broxbourne, Hertfordshire, East of England, England, EN11 8HX, United Kingdom",
|
||||
:lat => 51.7634883, :lon => -0.0088373,
|
||||
:type => "way", :id => 3489841, :zoom => 17
|
||||
:type => "way", :id => 3489841, :zoom => 17
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class OauthClientsControllerTest < ActionController::TestCase
|
|||
:client_application => {
|
||||
:name => "Test Application"
|
||||
}
|
||||
}, { :user => user }
|
||||
}, { :user => user }
|
||||
end
|
||||
assert_response :success
|
||||
assert_template "new"
|
||||
|
@ -96,7 +96,7 @@ class OauthClientsControllerTest < ActionController::TestCase
|
|||
:name => "Test Application",
|
||||
:url => "http://test.example.com/"
|
||||
}
|
||||
}, { :user => user }
|
||||
}, { :user => user }
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_redirected_to oauth_client_path(:id => ClientApplication.find_by_name("Test Application").id)
|
||||
|
@ -163,7 +163,7 @@ class OauthClientsControllerTest < ActionController::TestCase
|
|||
:name => "New Name",
|
||||
:url => nil
|
||||
}
|
||||
}, { :user => user }
|
||||
}, { :user => user }
|
||||
assert_response :success
|
||||
assert_template "edit"
|
||||
|
||||
|
@ -174,7 +174,7 @@ class OauthClientsControllerTest < ActionController::TestCase
|
|||
:name => "New Name",
|
||||
:url => "http://new.example.com/url"
|
||||
}
|
||||
}, { :user => user }
|
||||
}, { :user => user }
|
||||
assert_response :redirect
|
||||
assert_redirected_to oauth_client_path(:id => client.id)
|
||||
end
|
||||
|
|
|
@ -147,7 +147,7 @@ class OldNodeControllerTest < ActionController::TestCase
|
|||
check_not_found_id_version(70000, 312344)
|
||||
check_not_found_id_version(-1, -13)
|
||||
check_not_found_id_version(nodes(:visible_node).id, 24354)
|
||||
check_not_found_id_version(24356, nodes(:visible_node).version)
|
||||
check_not_found_id_version(24356, nodes(:visible_node).version)
|
||||
end
|
||||
|
||||
def check_not_found_id_version(id, version)
|
||||
|
|
|
@ -292,7 +292,7 @@ class SiteControllerTest < ActionController::TestCase
|
|||
# Test editing a specific note
|
||||
def test_edit_with_note
|
||||
user = users(:public_user)
|
||||
note = notes(:open_note)
|
||||
note = notes(:open_note)
|
||||
|
||||
get :edit, { :note => note.id }, { :user => user.id }
|
||||
assert_response :success
|
||||
|
|
|
@ -20,7 +20,7 @@ class LocaleTest < ActionDispatch::IntegrationTest
|
|||
assert_equal [], User.find(user.id).languages
|
||||
assert_select "html[lang=?]", "en"
|
||||
|
||||
get "/diary/new", {}, { "HTTP_ACCEPT_LANGUAGE" => "fr, en" }
|
||||
get "/diary/new", {}, { "HTTP_ACCEPT_LANGUAGE" => "fr, en" }
|
||||
assert_equal %w(fr en), User.find(user.id).languages
|
||||
assert_select "html[lang=?]", "fr"
|
||||
end
|
||||
|
|
|
@ -26,8 +26,8 @@ class BoundingBoxTest < ActiveSupport::TestCase
|
|||
@bad_lat_mixed_bbox = %w(0,0.1,0.1,0 -0.1,80,0.1,70 0.24,54.34,0.25,54.33)
|
||||
@bad_lon_mixed_bbox = %w(80,-0.1,70,0.1 54.34,0.24,54.33,0.25)
|
||||
@bad_limit_bbox = %w(-180.1,-90,180,90 -180,-90.1,180,90 -180,-90,180.1,90 -180,-90,180,90.1)
|
||||
@good_bbox = %w(-0.1,-0.1,0.1,0.1 51.1,-0.1,51.2,0 -0.1,%20-0.1,%200.1,%200.1
|
||||
-0.1edcd,-0.1d,0.1,0.1 -0.1E,-0.1E,0.1S,0.1N S0.1,W0.1,N0.1,E0.1)
|
||||
@good_bbox = %w(-0.1,-0.1,0.1,0.1 51.1,-0.1,51.2,0 -0.1,%20-0.1,%200.1,%200.1
|
||||
-0.1edcd,-0.1d,0.1,0.1 -0.1E,-0.1E,0.1S,0.1N S0.1,W0.1,N0.1,E0.1)
|
||||
|
||||
@expand_min_lon_array = %w(2,10,10,10 1,10,10,10 0,10,10,10 -1,10,10,10 -2,10,10,10 -8,10,10,10)
|
||||
@expand_min_lat_array = %w(10,2,10,10 10,1,10,10 10,0,10,10 10,-1,10,10 10,-2,10,10 10,-8,10,10)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue