Skip to content

Commit

Permalink
Fix the FormatString rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Sep 5, 2019
1 parent 1c13075 commit e1e2bc3
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 17 deletions.
12 changes: 1 addition & 11 deletions .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.
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/objects_controller.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/models/symphony_reader.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/okcomputer.rb
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions spec/controllers/marcxml_controller_spec.rb
Expand Up @@ -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 '<record'
Expand All @@ -33,7 +33,7 @@

describe 'GET mods' do
it 'transforms the MARCXML into MODS' 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 :mods, params: { catkey: '12345' }
expect(response.body).to match(/mods/)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/models/symphony_reader_spec.rb
Expand Up @@ -8,7 +8,7 @@

describe '#to_marc' do
before do
stub_request(:get, Settings.catalog.symphony.json_url % { catkey: catkey }).to_return(body: body.to_json)
stub_request(:get, format(Settings.catalog.symphony.json_url, catkey: catkey)).to_return(body: body.to_json)
end

let(:body) do
Expand Down

0 comments on commit e1e2bc3

Please sign in to comment.