diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7b99fc85d9..b3c2340844 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-10-06 15:10:31 UTC using RuboCop version 1.56.4. +# on 2023-12-05 17:36:18 UTC using RuboCop version 1.58.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 @@ -190,7 +190,7 @@ RSpec/BeforeAfterAll: - 'spec/models/blacklight/document/dublin_core_spec.rb' - 'spec/models/blacklight/solr/document_spec.rb' -# Offense count: 103 +# Offense count: 104 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without RSpec/ContextWording: @@ -202,7 +202,7 @@ RSpec/EmptyExampleGroup: Exclude: - 'spec/models/blacklight/solr/search_builder_spec.rb' -# Offense count: 134 +# Offense count: 135 # Configuration parameters: CountAsOne. RSpec/ExampleLength: Max: 33 @@ -278,7 +278,7 @@ RSpec/MessageSpies: - 'spec/presenters/blacklight/field_presenter_spec.rb' - 'spec/presenters/thumbnail_presenter_spec.rb' -# Offense count: 379 +# Offense count: 382 RSpec/MultipleExpectations: Max: 16 @@ -481,7 +481,15 @@ Style/GuardClause: - 'app/helpers/blacklight/catalog_helper_behavior.rb' - 'lib/blacklight/solr/search_builder_behavior.rb' -# Offense count: 27 +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowedReceivers. +# AllowedReceivers: Thread.current +Style/HashEachMethods: + Exclude: + - 'lib/blacklight/configuration.rb' + +# Offense count: 29 # This cop supports safe autocorrection (--autocorrect). Style/IfUnlessModifier: Enabled: false @@ -549,6 +557,21 @@ Style/PercentLiteralDelimiters: - 'lib/blacklight/engine.rb' - 'lib/blacklight/solr/request.rb' +# Offense count: 15 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantParentheses: + Exclude: + - 'app/components/blacklight/advanced_search_form_component.rb' + - 'app/components/blacklight/document/actions_component.rb' + - 'app/components/blacklight/document_component.rb' + - 'app/components/blacklight/document_metadata_component.rb' + - 'app/components/blacklight/metadata_field_layout_component.rb' + - 'app/components/blacklight/system/dropdown_component.rb' + - 'app/views/catalog/_document.atom.builder' + - 'lib/blacklight/search_state/pivot_filter_field.rb' + - 'lib/railties/blacklight.rake' + - 'spec/models/blacklight/solr/search_builder_spec.rb' + # Offense count: 6 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle. diff --git a/app/components/blacklight/advanced_search_form_component.rb b/app/components/blacklight/advanced_search_form_component.rb index 445fd294ef..de632fdcce 100644 --- a/app/components/blacklight/advanced_search_form_component.rb +++ b/app/components/blacklight/advanced_search_form_component.rb @@ -55,7 +55,7 @@ def initialize_search_field_controls def initialize_search_filter_controls fields = blacklight_config.facet_fields.select { |_k, v| v.include_in_advanced_search || v.include_in_advanced_search.nil? } - fields.each do |_k, config| + fields.each_value do |config| display_facet = @response.aggregations[config.field] with_search_filter_control(config: config, display_facet: display_facet) end diff --git a/app/components/blacklight/icons/legacy_icon_component.rb b/app/components/blacklight/icons/legacy_icon_component.rb index 0775103254..622220a525 100644 --- a/app/components/blacklight/icons/legacy_icon_component.rb +++ b/app/components/blacklight/icons/legacy_icon_component.rb @@ -11,7 +11,7 @@ def initialize(name:, classes: '', aria_hidden: false, label: true, role: 'img', end def call - tag.span(svg&.html_safe || default_icon, # rubocop:disable Rails/OutputSafety + tag.span(svg&.html_safe || default_icon, # rubocop:disable Rails/OutputSafety class: "blacklight-icons blacklight-icon-#{@name} #{@classes}".strip, 'aria-hidden': (true if @aria_hidden)) end diff --git a/lib/blacklight/solr/response/params.rb b/lib/blacklight/solr/response/params.rb index b40cd21a18..ed859104bf 100644 --- a/lib/blacklight/solr/response/params.rb +++ b/lib/blacklight/solr/response/params.rb @@ -31,7 +31,7 @@ def facet_field_aggregation_options(facet_field_name) defaults = { sort: single_valued_param(:'facet.sort'), limit: single_valued_param(:'facet.limit')&.to_i || 100, - offset: single_valued_param(:'facet.offset')&.to_i || 0, + offset: single_valued_param(:'facet.offset').to_i, prefix: single_valued_param(:'facet.prefix') } diff --git a/spec/controllers/catalog_controller_spec.rb b/spec/controllers/catalog_controller_spec.rb index 7ace5eaf3c..7ce41dda8f 100644 --- a/spec/controllers/catalog_controller_spec.rb +++ b/spec/controllers/catalog_controller_spec.rb @@ -54,7 +54,7 @@ it "has no docs or facet values for query without results", integration: true do get :index, params: { q: 'sadfdsafasdfsadfsadfsadf' } # query for no results expect(assigns(:response).docs).to be_empty - assigns(:response).aggregations.each do |_key, facet| + assigns(:response).aggregations.each_value do |facet| expect(facet.items).to be_empty end end @@ -815,7 +815,7 @@ def export_as_mock def assert_facets_have_values(aggregations) expect(aggregations).not_to be_empty # should have at least one value for each facet - aggregations.each do |_key, facet| + aggregations.each_value do |facet| expect(facet.items).to have_at_least(1).item end end diff --git a/spec/models/blacklight/solr/response_spec.rb b/spec/models/blacklight/solr/response_spec.rb index 77ab47741d..4d3608d69c 100644 --- a/spec/models/blacklight/solr/response_spec.rb +++ b/spec/models/blacklight/solr/response_spec.rb @@ -48,7 +48,7 @@ expect(received).to eq expected - r.aggregations.each do |_key, facet| + r.aggregations.each_value do |facet| expect(facet).to respond_to :name expect(facet).to respond_to :sort expect(facet).to respond_to :offset