Skip to content

Commit

Permalink
Merge branch 'develop' into depfu/update/rubocop-performance-1.20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieing authored Jan 26, 2024
2 parents e3c5e3b + 6d0fd15 commit 91f085a
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 16 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ AllCops:
- 'vendor/**/*'
- db/schema.rb
- db/views_schema.rb
- db/migrate/*
SuggestExtensions: false

Style/DocumentDynamicEvalDefinition:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.3
3.1.2
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ruby:2.7
FROM ruby:3.1.2

RUN gem install bundler -v 2.4.22
RUN gem install bundler

# throw errors if Gemfile has been modified since Gemfile.lock
RUN bundle config --global frozen 1
Expand Down
7 changes: 4 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ GEM
railties (>= 5.0.0)
ffi (1.15.5)
formatador (1.1.0)
guard (2.18.0)
guard (2.18.1)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (>= 1.0.12, < 2.0)
Expand Down Expand Up @@ -81,7 +81,7 @@ GEM
loofah (2.21.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
lumberjack (1.2.8)
lumberjack (1.2.9)
method_source (1.0.0)
mini_portile2 (2.8.4)
minitest (5.20.0)
Expand Down Expand Up @@ -169,10 +169,11 @@ GEM
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.20.2)
rubocop-rails (2.23.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rspec (2.23.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
Expand Down
2 changes: 1 addition & 1 deletion app/models/associated_with_roles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def maintain_users
users.create!(
users_to_maintain.map do |role, user_details|
user_details.map do |details|
details.reverse_merge(role: role.to_s, associated_id: id, last_updated: last_updated)
details.reverse_merge(role: role.to_s, associated_id: id, last_updated:)
end
end
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def down
t.remove :pac_bio_library_tube_barcode
end
# Here we add a placeholder value in case any plate barcodes were added as null since the migration
PacBioRun.where(plate_barcode: nil).each do |run|
PacBioRun.where(plate_barcode: nil).find_each do |run|
run.plate_barcode = 'plate_barcode placeholder'
run.save
end
Expand Down
2 changes: 2 additions & 0 deletions lib/resource_tools/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def custom_value(name, &block)
end
end

# rubocop:disable Naming/BlockForwarding
def initialize(*args, &block)
super
if self.class.custom_values.present?
Expand All @@ -156,6 +157,7 @@ def initialize(*args, &block)
convert_booleans
delete_if { |k, _| ignoreable.include?(k) }
end
# rubocop:enable Naming/BlockForwarding

def convert_booleans
self.stored_as_boolean.each do |key|
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/remove_duplicate_pac_bio_runs.rake
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ namespace :pac_bio_run_table do
9993
]
task remove_duplicate_pac_bio_runs: :environment do
PacBioRun.where(id_pac_bio_run_lims: list_of_runs).each do |pac_bio_run|
PacBioRun.where(id_pac_bio_run_lims: list_of_runs).find_each do |pac_bio_run|
puts "Going to remove #{pac_bio_run.id_pac_bio_run_lims}"
puts pac_bio_run.attributes
pac_bio_run.delete
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/update_pac_bio_run_name.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ namespace :pac_bio_run_table do
desc 'Update pac_bio_run_name column with the values from id_pac_bio_run_lims'

task update_pac_bio_run_name: :environment do
PacBioRun.all.each do |run|
PacBioRun.find_each do |run|
next if run.pac_bio_run_name.present?

run.pac_bio_run_name = run.id_pac_bio_run_lims
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace :pac_bio_run_table do
desc 'Update pac_bio_run plate_number column with the value 1 for sequencescape plates'

task update_pac_bio_run_sequencescape_plate_numbers: :environment do
PacBioRun.where(id_lims: 'SQSCP').each do |run|
PacBioRun.where(id_lims: 'SQSCP').find_each do |run|
run.plate_number = 1
run.save!
end
Expand Down
4 changes: 2 additions & 2 deletions spec/models/flowcell_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
include_examples 'full flowcell json'

it 'flags all entries as spiked' do
Flowcell.all.each { |fc| expect(fc.spiked).to be_true }
Flowcell.find_each { |fc| expect(fc.spiked).to be_true }
end

context 'when update with identical tag indexes' do
Expand Down Expand Up @@ -130,7 +130,7 @@
end

it 'flags all entries as not-spiked' do
Flowcell.all.each { |fc| expect(fc.spiked).to be_false }
Flowcell.find_each { |fc| expect(fc.spiked).to be_false }
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/support/it_behaves_like_a_nested_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
end

it 'ensures that the all rows are current' do
described_class.all.each do |row|
described_class.find_each do |row|
expect(row.last_updated).to eq(most_recent_time)
end
end

it 'ensures the row is marked with recorded time' do
described_class.all.each do |row|
described_class.find_each do |row|
expect(row.recorded_at).to eq(recorded_time)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/it_behaves_like_associated_with_roles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

shared_examples_for 'maintains roles correctly' do
after(:each) do
described_class.create_or_update_from_json(timestamped_json.merge(updated_roles).merge(updated_at: updated_at), 'example')
described_class.create_or_update_from_json(timestamped_json.merge(updated_roles).merge(updated_at:), 'example')
users_fit_exactly(expected_roles)
end

Expand Down

0 comments on commit 91f085a

Please sign in to comment.