Fix some Naming/AccessorMethodName rubocop warnings
This commit is contained in:
parent
cfb4a70129
commit
5d67fa3908
7 changed files with 10 additions and 12 deletions
|
@ -99,12 +99,10 @@ Metrics/PerceivedComplexity:
|
|||
Minitest/MultipleAssertions:
|
||||
Max: 52
|
||||
|
||||
# Offense count: 3
|
||||
# Offense count: 1
|
||||
Naming/AccessorMethodName:
|
||||
Exclude:
|
||||
- 'app/controllers/application_controller.rb'
|
||||
- 'app/helpers/title_helper.rb'
|
||||
- 'lib/osm.rb'
|
||||
|
||||
# Offense count: 8
|
||||
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
|
||||
|
|
|
@ -100,7 +100,7 @@ class ApiController < ApplicationController
|
|||
elsif Authenticator.new(self, [:token]).allow?
|
||||
# self.current_user setup by OAuth
|
||||
else
|
||||
username, passwd = get_auth_data # parse from headers
|
||||
username, passwd = auth_data # parse from headers
|
||||
# authenticate per-scheme
|
||||
self.current_user = if username.nil?
|
||||
nil # no authentication provided - perhaps first connect (client should retry after 401)
|
||||
|
|
|
@ -161,7 +161,7 @@ class ApplicationController < ActionController::Base
|
|||
response.headers["Error"] = message
|
||||
|
||||
if request.headers["X-Error-Format"]&.casecmp("xml")&.zero?
|
||||
result = OSM::API.new.get_xml_doc
|
||||
result = OSM::API.new.xml_doc
|
||||
result.root.name = "osmError"
|
||||
result.root << (XML::Node.new("status") << "#{Rack::Utils.status_code(status)} #{Rack::Utils::HTTP_STATUS_CODES[status]}")
|
||||
result.root << (XML::Node.new("message") << message)
|
||||
|
@ -363,7 +363,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
# extract authorisation credentials from headers, returns user = nil if none
|
||||
def get_auth_data
|
||||
def auth_data
|
||||
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
|
||||
|
|
|
@ -128,7 +128,7 @@ class DiffReader
|
|||
@reader.read
|
||||
raise OSM::APIBadUserInput, "Document element should be 'osmChange'." if @reader.name != "osmChange"
|
||||
|
||||
result = OSM::API.new.get_xml_doc
|
||||
result = OSM::API.new.xml_doc
|
||||
result.root.name = "diffResult"
|
||||
|
||||
# loop at the top level, within the <osmChange> element
|
||||
|
|
|
@ -445,7 +445,7 @@ module OSM
|
|||
end
|
||||
|
||||
class API
|
||||
def get_xml_doc
|
||||
def xml_doc
|
||||
doc = XML::Document.new
|
||||
doc.encoding = XML::Encoding::UTF_8
|
||||
root = XML::Node.new "osm"
|
||||
|
|
|
@ -1036,7 +1036,7 @@ module Api
|
|||
version = nil
|
||||
|
||||
with_controller(Api::ChangesetsController.new) do
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
doc = OSM::API.new.xml_doc
|
||||
change = XML::Node.new "osmChange"
|
||||
doc.root = change
|
||||
modify = XML::Node.new "modify"
|
||||
|
|
|
@ -255,7 +255,7 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def xml_for_node(node)
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
doc = OSM::API.new.xml_doc
|
||||
doc.root << xml_node_for_node(node)
|
||||
doc
|
||||
end
|
||||
|
@ -277,7 +277,7 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def xml_for_way(way)
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
doc = OSM::API.new.xml_doc
|
||||
doc.root << xml_node_for_way(way)
|
||||
doc
|
||||
end
|
||||
|
@ -308,7 +308,7 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def xml_for_relation(relation)
|
||||
doc = OSM::API.new.get_xml_doc
|
||||
doc = OSM::API.new.xml_doc
|
||||
doc.root << xml_node_for_relation(relation)
|
||||
doc
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue