Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to ruby 3.0 in the Dockerfile #2997

Merged
merged 5 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
bundler: latest
bundler: '2.4.22'
ruby-version: ${{ matrix.ruby }}
- name: Run tests
run: bundle exec rake
Expand Down
146 changes: 17 additions & 129 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,106 +1,21 @@
# This configuration was generated by
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
# using RuboCop version 1.50.2.
# using RuboCop version 1.59.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 13
# Offense count: 18
# Configuration parameters: EnforcedStyle, AllowedGems, Include.
# SupportedStyles: Gemfile, gems.rb, gemspec
# Include: **/*.gemspec, **/Gemfile, **/gems.rb
Gemspec/DevelopmentDependencies:
Exclude:
- 'blacklight-spotlight.gemspec'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleAlignWith.
# SupportedStylesAlignWith: either, start_of_block, start_of_line
Layout/BlockAlignment:
Exclude:
- 'spec/controllers/spotlight/solr_controller_spec.rb'
- 'spec/features/item_admin_spec.rb'
- 'spec/helpers/spotlight/main_app_helpers_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
Layout/BlockEndNewline:
Exclude:
- 'spec/controllers/spotlight/solr_controller_spec.rb'
- 'spec/features/item_admin_spec.rb'
- 'spec/helpers/spotlight/main_app_helpers_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Layout/ClosingParenthesisIndentation:
Exclude:
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb'

# Offense count: 10
# This cop supports safe autocorrection (--autocorrect).
Layout/EmptyLines:
Exclude:
- 'spec/controllers/spotlight/solr_controller_spec.rb'
- 'spec/features/item_admin_spec.rb'
- 'spec/helpers/spotlight/main_app_helpers_spec.rb'
- 'spec/views/spotlight/browse/_search.html.erb_spec.rb'
- 'spec/views/spotlight/browse/show.html.erb_spec.rb'
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb'
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb'
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
Layout/FirstArgumentIndentation:
Exclude:
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb'

# Offense count: 22
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: normal, indented_internal_methods
Layout/IndentationConsistency:
Exclude:
- 'spec/controllers/spotlight/solr_controller_spec.rb'
- 'spec/features/item_admin_spec.rb'
- 'spec/helpers/spotlight/main_app_helpers_spec.rb'
- 'spec/views/spotlight/browse/_search.html.erb_spec.rb'
- 'spec/views/spotlight/browse/show.html.erb_spec.rb'
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb'
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb'
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb'

# Offense count: 8
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Width, AllowedPatterns.
Layout/IndentationWidth:
Exclude:
- 'spec/controllers/spotlight/solr_controller_spec.rb'
- 'spec/features/item_admin_spec.rb'
- 'spec/helpers/spotlight/main_app_helpers_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
Layout/MultilineBlockLayout:
Exclude:
- 'spec/controllers/spotlight/solr_controller_spec.rb'
- 'spec/features/item_admin_spec.rb'
- 'spec/helpers/spotlight/main_app_helpers_spec.rb'

# Offense count: 4
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'spec/controllers/spotlight/solr_controller_spec.rb'
- 'spec/features/item_admin_spec.rb'
- 'spec/helpers/spotlight/main_app_helpers_spec.rb'

# Offense count: 8
# Configuration parameters: AllowedMethods, AllowedPatterns.
Lint/AmbiguousBlockAssociation:
Exclude:
Expand Down Expand Up @@ -144,6 +59,7 @@ Lint/EmptyFile:
- 'spec/lib/spotlight/catalog_spec.rb'

# Offense count: 1
# Configuration parameters: AllowedParentClasses.
Lint/MissingSuper:
Exclude:
- 'app/services/spotlight/carrierwave_file_resolver.rb'
Expand All @@ -153,19 +69,14 @@ Lint/NoReturnInBeginEndBlocks:
Exclude:
- 'app/models/spotlight/exhibit.rb'

# Offense count: 1
# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedMethods.
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?, presence, present?
Lint/RedundantSafeNavigation:
Exclude:
- 'app/controllers/spotlight/catalog_controller.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/RedundantStringCoercion:
Exclude:
- 'lib/tasks/spotlight_tasks.rake'
- 'app/services/spotlight/bulk_updates_csv_template_service.rb'

# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
Expand Down Expand Up @@ -205,6 +116,7 @@ Naming/HeredocDelimiterNaming:
- 'spec/test_app_templates/lib/generators/test_app_generator.rb'

# Offense count: 8
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyleForLeadingUnderscores.
# SupportedStylesForLeadingUnderscores: disallowed, required, optional
Naming/MemoizedInstanceVariableName:
Expand Down Expand Up @@ -367,19 +279,6 @@ RSpec/RepeatedExampleGroupBody:
Exclude:
- 'spec/controllers/spotlight/featured_images_controller_spec.rb'

# Offense count: 10
# This cop supports safe autocorrection (--autocorrect).
RSpec/ScatteredSetup:
Exclude:
- 'spec/controllers/spotlight/solr_controller_spec.rb'
- 'spec/features/item_admin_spec.rb'
- 'spec/helpers/spotlight/main_app_helpers_spec.rb'
- 'spec/views/spotlight/browse/_search.html.erb_spec.rb'
- 'spec/views/spotlight/browse/show.html.erb_spec.rb'
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_block.html.erb_spec.rb'
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_embed_block.html.erb_spec.rb'
- 'spec/views/spotlight/sir_trevor/blocks/_solr_documents_grid_block.html.erb_spec.rb'

# Offense count: 59
RSpec/StubbedMock:
Enabled: false
Expand Down Expand Up @@ -555,20 +454,8 @@ Rails/UnknownEnv:
Exclude:
- 'spec/test_app_templates/carrierwave.rb'

# Offense count: 5
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
# FunctionalMethods: let, let!, subject, watch
# AllowedMethods: lambda, proc, it
Style/BlockDelimiters:
Exclude:
- 'spec/controllers/spotlight/solr_controller_spec.rb'
- 'spec/features/item_admin_spec.rb'
- 'spec/helpers/spotlight/main_app_helpers_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/CombinableLoops:
Exclude:
- 'app/services/spotlight/exhibit_import_export_service.rb'
Expand All @@ -579,27 +466,34 @@ Style/CommentedKeyword:
Exclude:
- 'spec/features/javascript/search_config_admin_spec.rb'

# Offense count: 3
# Offense count: 8
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/ConcatArrayLiterals:
Exclude:
- 'app/controllers/spotlight/about_pages_controller.rb'
- 'app/controllers/spotlight/feature_pages_controller.rb'
- 'app/controllers/spotlight/home_pages_controller.rb'
- 'app/models/spotlight/about_page.rb'
- 'app/models/spotlight/exhibit.rb'
- 'app/models/spotlight/feature_page.rb'
- 'app/models/spotlight/home_page.rb'
- 'app/models/spotlight/page.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/GlobalStdStream:
Exclude:
- 'lib/tasks/spotlight_tasks.rake'

# Offense count: 1
# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedReceivers.
# AllowedReceivers: Thread.current
Style/HashEachMethods:
Exclude:
- 'app/controllers/spotlight/roles_controller.rb'
- 'app/models/spotlight/blacklight_configuration.rb'
- 'spec/features/browse_category_spec.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Expand Down Expand Up @@ -659,12 +553,6 @@ Style/RedundantInitialize:
Exclude:
- 'lib/migration/page_language.rb'

# Offense count: 2
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpEscape:
Exclude:
- 'app/models/spotlight/contact_form.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SelectByRegexp:
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG RUBY_VERSION=2.7.7
ARG RUBY_VERSION=3.0.6
ARG ALPINE_VERSION=3.16
FROM ruby:$RUBY_VERSION-alpine$ALPINE_VERSION

Expand Down Expand Up @@ -33,7 +33,7 @@ RUN addgroup --gid 10001 --system spotlight && \

USER spotlight
RUN gem update bundler
RUN gem install --no-document rails -v "${RAILS_VERISION}"
RUN gem install --no-document rails -v "${RAILS_VERSION}"

COPY --chown=10000:10001 . /spotlight/engine
WORKDIR /spotlight/engine
Expand All @@ -44,6 +44,8 @@ WORKDIR /spotlight/app

RUN SKIP_TRANSLATION=yes rails _${RAILS_VERSION}_ new . -j webpack --force --template=../engine/template.rb
RUN bundle add pg
RUN bin/yarn add @babel/plugin-proposal-private-methods --dev
RUN bin/yarn add @babel/plugin-proposal-private-property-in-object
RUN SKIP_TRANSLATION=yes DB_ADAPTER=nulldb DATABASE_URL='postgresql://fake' bundle exec rake assets:precompile

ENTRYPOINT ["/sbin/tini", "--", "/spotlight/engine/bin/docker-entrypoint.sh"]
Expand Down
2 changes: 1 addition & 1 deletion app/services/spotlight/etl/executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def estimated_size
# @private
# @yield Logger
def with_logger
logger = (context&.logger || Rails.logger)
logger = context&.logger || Rails.logger
logger.tagged(pipeline.class) do
logger.tagged("#<#{source.class} id=#{source&.id if source.respond_to?(:id)}>") do
@logger = logger
Expand Down
2 changes: 1 addition & 1 deletion spec/features/add_contacts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
expect(page).to have_selector 'div', text: 'Emperor'
expect(page).to have_selector 'div', text: 'Rome'
expect(page).to have_selector 'div', text: '(555) 555-5555 ext. 12345 (mobile)'
expect(page).not_to have_selector 'img.contact-photo'
expect(page).to have_no_selector 'img.contact-photo'
end
end

Expand Down
4 changes: 2 additions & 2 deletions spec/features/add_custom_field_metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
it 'has a public toggle' do
visit spotlight.exhibit_solr_document_path(exhibit, 'dq287tq6352')

expect(page).not_to have_selector '.blacklight-private'
expect(page).to have_no_selector '.blacklight-private'

click_on 'Edit'

Expand All @@ -83,6 +83,6 @@

click_on 'Save changes'

expect(page).not_to have_selector '.blacklight-private'
expect(page).to have_no_selector '.blacklight-private'
end
end
2 changes: 1 addition & 1 deletion spec/features/add_items_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
it 'does not display the raw documents upload form' do
visit spotlight.new_exhibit_resource_path(exhibit)
click_link 'Upload raw documents'
expect(page).not_to have_css('form#new_resources_json_upload')
expect(page).to have_no_css('form#new_resources_json_upload')
end

context 'as an site administrator' do
Expand Down
6 changes: 3 additions & 3 deletions spec/features/autocomplete_typeahead_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
visit spotlight.edit_exhibit_appearance_path(exhibit)
click_link 'Exhibit masthead'

expect(page).not_to have_css('.leaflet-container')
expect(page).to have_no_css('.leaflet-container')

check 'Show background image in masthead'

Expand Down Expand Up @@ -65,7 +65,7 @@

fill_in_typeahead_field(with: 'gk446cj2442', type: 'featured-image')

expect(page).not_to have_css('[data-panel-image-pagination]', text: /Image 1 of 2/)
expect(page).to have_no_css('[data-panel-image-pagination]', text: /Image 1 of 2/)
end
end

Expand All @@ -78,7 +78,7 @@
visit spotlight.edit_exhibit_appearance_path(exhibit)
click_link 'Exhibit masthead'

expect(page).not_to have_css('[data-behavior="non-iiif-alert"]', visible: true)
expect(page).to have_no_css('[data-behavior="non-iiif-alert"]', visible: true)

fill_in_typeahead_field(with: 'gk446cj2442', type: 'featured-image')

Expand Down
2 changes: 1 addition & 1 deletion spec/features/browse_category_admin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
click_link('Delete')
end
expect(page).to have_content('Search was deleted')
expect(page).not_to have_content(search.title)
expect(page).to have_no_content(search.title)
end
end
end
Loading