From e1e2bc30d30f5ea17b1fd8ae2642b2ab7d26d1b2 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Thu, 5 Sep 2019 13:45:28 -0500 Subject: [PATCH] Fix the FormatString rubocop --- .rubocop_todo.yml | 12 +----------- app/controllers/objects_controller.rb | 2 +- app/models/symphony_reader.rb | 2 +- config/initializers/okcomputer.rb | 2 +- spec/controllers/marcxml_controller_spec.rb | 4 ++-- spec/models/symphony_reader_spec.rb | 2 +- 6 files changed, 7 insertions(+), 17 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8681bf04db..ad9a5f1d6b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,3 +1,4 @@ + # This configuration was generated by # `rubocop --auto-gen-config` # on 2019-09-03 07:47:22 -0500 using RuboCop version 0.65.0. @@ -283,17 +284,6 @@ Style/ExpandPathArguments: - 'bin/rake' - 'spec/rails_helper.rb' -# Offense count: 5 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: format, sprintf, percent -Style/FormatString: - Exclude: - - 'app/models/symphony_reader.rb' - - 'config/initializers/okcomputer.rb' - - 'spec/controllers/marcxml_controller_spec.rb' - - 'spec/models/symphony_reader_spec.rb' - # Offense count: 1 # Configuration parameters: MinBodyLength. Style/GuardClause: diff --git a/app/controllers/objects_controller.rb b/app/controllers/objects_controller.rb index 86832cf3c9..575a939aea 100644 --- a/app/controllers/objects_controller.rb +++ b/app/controllers/objects_controller.rb @@ -44,7 +44,7 @@ def update # Update the constituent relationship errors = ConstituentService.new(parent_druid: params[:id]).add(child_druids: filtered_params[:constituent_ids]) - return render json: { errors: errors.to_json }, status: 422 if errors + return render json: { errors: errors.to_json }, status: :unprocessable_entity if errors head :no_content end diff --git a/app/models/symphony_reader.rb b/app/models/symphony_reader.rb index dc06f7c4a0..3b6fc98160 100644 --- a/app/models/symphony_reader.rb +++ b/app/models/symphony_reader.rb @@ -37,7 +37,7 @@ def client end def json - @json ||= JSON.parse(client.get(Settings.catalog.symphony.json_url % { catkey: catkey }).body) + @json ||= JSON.parse(client.get(format(Settings.catalog.symphony.json_url, catkey: catkey)).body) end def bib_record diff --git a/config/initializers/okcomputer.rb b/config/initializers/okcomputer.rb index d667d0290b..ac8e82a099 100644 --- a/config/initializers/okcomputer.rb +++ b/config/initializers/okcomputer.rb @@ -32,6 +32,6 @@ def perform_request end OkComputer::Registry.register 'version', CustomAppVersionCheck.new -OkComputer::Registry.register 'external-symphony', SymphonyCheck.new(Settings.catalog.symphony.json_url % { catkey: 12345 }) +OkComputer::Registry.register 'external-symphony', SymphonyCheck.new(format(Settings.catalog.symphony.json_url, catkey: 12345)) OkComputer.make_optional %w(external-symphony) diff --git a/spec/controllers/marcxml_controller_spec.rb b/spec/controllers/marcxml_controller_spec.rb index c72d9f91ae..a45749a4a1 100644 --- a/spec/controllers/marcxml_controller_spec.rb +++ b/spec/controllers/marcxml_controller_spec.rb @@ -24,7 +24,7 @@ describe 'GET marcxml' do it 'retrieves MARCXML' do - stub_request(:get, Settings.catalog.symphony.json_url % { catkey: resource.catkey }).to_return(body: '{}') + stub_request(:get, format(Settings.catalog.symphony.json_url, catkey: resource.catkey)).to_return(body: '{}') get :marcxml, params: { catkey: '12345' } expect(response.body).to start_with '