Fix more rubocop style issues

This commit is contained in:
Tom Hughes 2015-02-24 20:45:55 +00:00
parent 16da03aacb
commit a6b84a0294
24 changed files with 50 additions and 77 deletions

View file

@ -272,7 +272,7 @@ class ApplicationController < ActionController::Base
# phrase from that, we can also put the error message into the status
# message. For now, rails won't let us)
def report_error(message, status = :bad_request)
# Todo: some sort of escaping of problem characters in the message
# TODO: some sort of escaping of problem characters in the message
response.headers["Error"] = message
if request.headers["X-Error-Format"] &&

View file

@ -119,7 +119,7 @@ class SwfController < ApplicationController
def start_and_move(x, y, col)
d = "001001" # Line style change, moveTo
l = [length_sb(x), length_sb(y)].max
d += sprintf("%05b%0#{l}b%0#{l}b", l, x, y)
d += format("%05b%0*b%0*b", l, l, x, l, y)
d += col # Select line style
d
end
@ -147,9 +147,9 @@ class SwfController < ApplicationController
dx = x2 - x1
dy = y2 - y1
l = [length_sb(dx), length_sb(dy)].max
d += sprintf("%04b", l - 2)
d += format("%04b", l - 2)
d += "1" # GeneralLine
d += sprintf("%0#{l}b%0#{l}b", dx, dy)
d += format("%0*b%0*b", l, dx, l, dy)
d
end
@ -176,7 +176,7 @@ class SwfController < ApplicationController
length_sb(c),
length_sb(d)].max
# create binary string (00111001 etc.) - 5-byte length, then bbox
n = sprintf("%05b%0#{l}b%0#{l}b%0#{l}b%0#{l}b", l, a, b, c, d)
n = format("%05b%0*b%0*b%0*b%0*b", l, l, a, l, b, l, c, l, d)
# pack into byte string
[n].pack("B*")
end

View file

@ -1,11 +1,13 @@
require "htmlentities"
module TitleHelper
@@coder = HTMLEntities.new
def self.coder
@coder ||= HTMLEntities.new
end
def set_title(title = false)
if title
@title = @@coder.decode(title.gsub("<bdi>", "\u202a").gsub("</bdi>", "\u202c"))
@title = TitleHelper.coder.decode(title.gsub("<bdi>", "\u202a").gsub("</bdi>", "\u202c"))
response.headers["X-Page-Title"] = t("layouts.project_name.title") + " | " + @title
else
@title = title

View file

@ -141,7 +141,7 @@ class Node < ActiveRecord::Base
# update changeset bbox with *old* position first
changeset.update_bbox!(bbox)
# FIXME logic needs to be double checked
# FIXME: logic needs to be double checked
self.latitude = new_node.latitude
self.longitude = new_node.longitude
self.tags = new_node.tags

View file

@ -70,7 +70,7 @@ class OldWay < ActiveRecord::Base
add_metadata_to_xml_node(el, self, changeset_cache, user_display_name_cache)
old_nodes.each do |nd| # FIXME need to make sure they come back in the right order
old_nodes.each do |nd| # FIXME: need to make sure they come back in the right order
node_el = XML::Node.new "nd"
node_el["ref"] = nd.node_id.to_s
el << node_el

View file

@ -135,7 +135,7 @@ class Relation < ActiveRecord::Base
el
end
# FIXME is this really needed?
# FIXME: is this really needed?
def members
@members ||= relation_members.map do |member|
[member.member_type, member.member_id, member.member_role]

View file

@ -219,7 +219,7 @@ class Trace < ActiveRecord::Base
end
def xml_file
# TODO *nix specific, could do to work on windows... would be functionally inferior though - check for '.gz'
# TODO: *nix specific, could do to work on windows... would be functionally inferior though - check for '.gz'
filetype = `/usr/bin/file -bz #{trace_name}`.chomp
gzipped = filetype =~ /gzip compressed/
bzipped = filetype =~ /bzip2 compressed/