]> git.openstreetmap.org Git - rails.git/commitdiff
Fix some Naming/AccessorMethodName rubocop warnings
authorTom Hughes <tom@compton.nu>
Tue, 8 Mar 2022 19:10:05 +0000 (19:10 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 8 Mar 2022 19:10:05 +0000 (19:10 +0000)
.rubocop_todo.yml
app/controllers/api_controller.rb
app/controllers/application_controller.rb
lib/diff_reader.rb
lib/osm.rb
test/controllers/api/relations_controller_test.rb
test/test_helper.rb

index 64781f9192182e6cf25894c52ef6e79dfba67dfb..8c1ce723c67b165f5c4c9dba4de51d2437358591 100644 (file)
@@ -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.
index 2d8d51dd8507719f653228b39e358a6c86b6e72c..050c455cdf64f6bf09bf4e01db8849683fb0cc31 100644 (file)
@@ -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)
index bb32e7e6e5cbbe25da6787efc37dce39266e8c8d..1d68654055538fd597265043e2adcb52e3ceb94f 100644 (file)
@@ -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
index 1189c86d0e3236307ec4f4fdb50d42c7c5ecc150..d1987a93622f0d1a44eb128555f6f6cc4258bd26 100644 (file)
@@ -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
index ee0b8d9030ee719c769cdb0039edef17d8631e01..e258aaaf03a5aaadcb3b3b4ea7a509ec465f4cfc 100644 (file)
@@ -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"
index ec86e07a57ac242f60c71f11b90750695731b3df..eb8f8e02256eb5c3d8e97341a2f2758316199ba6 100644 (file)
@@ -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"
index 421ae8698847a0d1cbe7090045b69e37d37db389..7157abf5a71ed0ef153b70c50c3436a6b99c00c2 100644 (file)
@@ -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