Skip to content

Commit

Permalink
Update TargetRubyVersion to 3.2 for Rubocop and autocorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne committed Apr 15, 2024
1 parent 8a63141 commit 0d828e1
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require:
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 3.0
TargetRubyVersion: 3.2
Exclude:
- 'Gemfile'
- 'bin/**/*'
Expand Down
4 changes: 2 additions & 2 deletions app/models/purl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Purl < ApplicationRecord
default_scope -> { order(:updated_at) }
validates :druid, uniqueness: true

scope :object_type, -> (object_type) { where object_type: object_type }
scope :object_type, -> (object_type) { where object_type: }

scope :membership, lambda { |membership|
case membership['membership']
Expand Down Expand Up @@ -125,7 +125,7 @@ def refresh_collections(valid_collections)
def self.mark_deleted(druid, deleted_at = nil)
druid = "druid:#{druid}" unless druid.include?('druid:') # add the druid prefix if it happens to be missing
purl = begin
find_or_create_by(druid: druid) # either create a new druid record or get the existing one
find_or_create_by(druid:) # either create a new druid record or get the existing one
rescue ActiveRecord::RecordNotUnique
retry
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/release_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ class ReleaseTag < ApplicationRecord
# @param [Boolean] `release_type`
# @return [ReleaseTag] finds or creates a ReleaseTag record for the given tuple
def self.for(purl, name, release_type)
tag = ReleaseTag.find_by(name: name, purl_id: purl.id)
tag = ReleaseTag.find_by(name:, purl_id: purl.id)
if tag.present?
tag.release_type = release_type
else
tag = ReleaseTag.create(name: name, purl_id: purl.id, release_type: release_type)
tag = ReleaseTag.create(name:, purl_id: purl.id, release_type:)
end
tag
end
Expand Down
4 changes: 2 additions & 2 deletions app/services/purl_cocina_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ def attributes
title = cocina_data.title
if title&.match?(/[\u{10000}-\u{10FFFF}]/)
Honeybadger.notify('Unable to record title for item because it contains UTF8mb4 characters',
context: { title: title, druid: cocina_data.canonical_druid })
context: { title:, druid: cocina_data.canonical_druid })
title = nil
end
{
druid: cocina_data.canonical_druid,
title: title,
title:,
object_type: cocina_data.object_type,
catkey: cocina_data.catkey,
published_at: Time.current,
Expand Down
2 changes: 1 addition & 1 deletion spec/consumers/purl_updates_consumer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
let(:title) { "The Information Paradox for Black Holes" }
let(:message_value) do
build(:dro, id: purl_object.druid,
title: title,
title:,
collection_ids: ['druid:xb432gf1111'])
.new(administrative: {
hasAdminPolicy: "druid:hv992ry2431",
Expand Down
4 changes: 2 additions & 2 deletions spec/models/purl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@

describe '.mark_deleted' do
it 'always starts without deleted_at time' do
purl = described_class.create(druid: druid)
purl = described_class.create(druid:)
expect(purl.deleted_at?).to be_falsey
end

Expand All @@ -116,7 +116,7 @@
it 'marks a record as deleted with a given timestamp' do
deleted_at_time = Time.current
expect(described_class.mark_deleted(druid, deleted_at_time)).to be_truthy
purl = described_class.find_by(druid: druid)
purl = described_class.find_by(druid:)
expect(purl.deleted_at.iso8601).to eq deleted_at_time.iso8601 # favorable compare which removes milliseconds
end

Expand Down
2 changes: 1 addition & 1 deletion spec/requests/v1/docs_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
'2' => 'druid:cc111dd2222',
'3' => 'druid:ee111ff2222'
}.each_pair do |page, druid|
get '/docs/deletes', params: { per_page: 1, page: page }
get '/docs/deletes', params: { per_page: 1, page: }
data = JSON.parse(response.body, symbolize_names: true)
expect(data.dig(:deletes, 0, :druid)).to eq druid
expect(data[:deletes].count).to eq 1
Expand Down
8 changes: 4 additions & 4 deletions spec/requests/v1/purls_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
let(:headers) { { 'Content-Type' => 'application/json' } }
let(:title) { "The Information Paradox for Black Holes" }
let(:cocina_object) do
build(:dro_with_metadata, id: druid, title: title,
build(:dro_with_metadata, id: druid, title:,
collection_ids: ['druid:xb432gf1111'])
.new(administrative: {
hasAdminPolicy: "druid:hv992ry2431",
Expand All @@ -30,7 +30,7 @@

it 'creates a new purl entry' do
expect do
post "/purls/#{druid}", params: data, headers: headers
post "/purls/#{druid}", params: data, headers:
end.to change(Purl, :count).by(1)
expect(response).to have_http_status(:accepted)
expect(Racecar).to have_received(:produce_sync)
Expand All @@ -44,7 +44,7 @@

it 'creates a new purl entry' do
expect do
post "/purls/#{druid}", params: data, headers: headers
post "/purls/#{druid}", params: data, headers:
end.not_to change(Purl, :count)
expect(response).to have_http_status(:unprocessable_entity)
expect(Racecar).not_to have_received(:produce_sync)
Expand All @@ -56,7 +56,7 @@
let(:druid) { purl_object.druid }

it 'updates the purl with new data' do
post "/purls/#{druid}", params: data, headers: headers
post("/purls/#{druid}", params: data, headers:)
expect(Racecar).to have_received(:produce_sync)
.with(key: druid, topic: 'purl-updates', value: expected_message_value)

Expand Down
2 changes: 1 addition & 1 deletion spec/views/v1/collections/_purl.json.jbuilder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
it 'ignores the catkey if it is blank' do
purl = Purl.find(1)
purl.catkey = ''
render partial: 'v1/collections/purl', locals: { purl: purl }
render partial: 'v1/collections/purl', locals: { purl: }
expect(JSON.parse(rendered)).not_to include('catkey')
end

Expand Down

0 comments on commit 0d828e1

Please sign in to comment.