From 5925c63a3492f2e9d5e9e483a2efd07d666eaa22 Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Mon, 22 Jan 2024 11:41:35 -0500 Subject: [PATCH] Addresses rubocop violations --- .../forms/pcdm_collection_form_decorator.rb | 2 +- app/indexers/concerns/hyku_indexing.rb | 2 ++ .../hyrax/permission_manager_decorator.rb | 3 +-- lib/hyrax/transactions/grapher.rb | 18 +++++++++++------- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/app/forms/hyrax/forms/pcdm_collection_form_decorator.rb b/app/forms/hyrax/forms/pcdm_collection_form_decorator.rb index 683beb958..7aceeca04 100644 --- a/app/forms/hyrax/forms/pcdm_collection_form_decorator.rb +++ b/app/forms/hyrax/forms/pcdm_collection_form_decorator.rb @@ -1,4 +1,4 @@ -# # frozen_string_literal: true +# frozen_string_literal: true Hyrax::Forms::PcdmCollectionForm.class_eval do include Hyrax::FormFields(:basic_metadata) diff --git a/app/indexers/concerns/hyku_indexing.rb b/app/indexers/concerns/hyku_indexing.rb index e552b677a..ea97bc9bc 100644 --- a/app/indexers/concerns/hyku_indexing.rb +++ b/app/indexers/concerns/hyku_indexing.rb @@ -9,6 +9,7 @@ module HykuIndexing [:generate_solr_document, :to_solr].each do |method_name| define_method method_name do |*args, **kwargs, &block| super(*args, **kwargs, &block).tap do |solr_doc| + # rubocop:disable Style/ClassCheck object = resource if object.kind_of?(Valkyrie::Resource) solr_doc['account_cname_tesim'] = Site.instance&.account&.cname @@ -16,6 +17,7 @@ module HykuIndexing solr_doc['account_institution_name_ssim'] = Site.instance.institution_label # TODO: Reinstate once valkyrie fileset work is complete - https://github.com/scientist-softserv/hykuup_knapsack/issues/34 solr_doc['all_text_tsimv'] = full_text(object.file_sets.first&.id) if object.kind_of?(ActiveFedora::Base) + # rubocop:enable Style/ClassCheck add_date(solr_doc) end end diff --git a/app/services/hyrax/permission_manager_decorator.rb b/app/services/hyrax/permission_manager_decorator.rb index 1d4ccc199..dc6e1436a 100644 --- a/app/services/hyrax/permission_manager_decorator.rb +++ b/app/services/hyrax/permission_manager_decorator.rb @@ -17,8 +17,7 @@ module Hyrax # as part of these overrides. module PermissionManagerDecorator # NOTE: The fallback to Group.new for special groups is necessary due to a fundamental - # change in between behavior in Valkyrie models vs ActiveFedora models. In - # ActiveFedora, the "public" access is granted some other way, but the + # change in between behavior in Valkyrie models vs ActiveFedora models. In # "public" groups now go through the access_control_list module, and # the group gets assigned to the objects here. Because Hyku persists # groups and "public" is not a real group, this errored because the group was diff --git a/lib/hyrax/transactions/grapher.rb b/lib/hyrax/transactions/grapher.rb index cf6942c94..1d32b1bd7 100644 --- a/lib/hyrax/transactions/grapher.rb +++ b/lib/hyrax/transactions/grapher.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Hyrax module Transactions ## @@ -15,18 +17,18 @@ module Transactions # "steps" => [] }}}} class Grapher # A best guess at how to find the published events within the source code of the transactions. - REGEXP_FOR_PUBLISH = %r{\.publish[\(\s]?['"]([\w\.]+)['"]}.freeze + REGEXP_FOR_PUBLISH = %r{\.publish[\(\s]?['"]([\w\.]+)['"]} # Because some transactions launch other transactions within their 'call' - REGEXP_FOR_INNER_STEPS = %r{ontainer\[['"]([\w\.]+)['"]\]}.freeze + REGEXP_FOR_INNER_STEPS = %r{ontainer\[['"]([\w\.]+)['"]\]} ## # @return [Hash] a graph of the transaction steps. def self.call(container: Hyrax::Transactions::Container) - new(container: container).call + new(container:).call end - def initialize(container: ) + def initialize(container:) @container = container end attr_reader :container @@ -35,9 +37,10 @@ def initialize(container: ) # @return [Hash] def call steps = extract_steps - treeify(steps: steps) + treeify(steps:) end + # rubocop:disable Metrics/MethodLength def extract_steps # First we gather all of the registered transactions. steps = {} @@ -69,7 +72,7 @@ def treeify(steps:) unvisited_transactions.delete(key) sub_steps = [] details["steps"].each do |step| - sub_steps << extract_substeps_from(dictionary: steps, current_step: step, unvisited_transactions: unvisited_transactions) + sub_steps << extract_substeps_from(dictionary: steps, current_step: step, unvisited_transactions:) end tree << { "name" => key, "class_name" => details["class_name"], "events" => details["events"], "steps" => sub_steps } @@ -81,6 +84,7 @@ def treeify(steps:) tree end + # rubocop:enable Metrics/MethodLength def extract_substeps_from(dictionary:, current_step:, unvisited_transactions:) # We want to avoid changing the dictionary as we're looping through points of reference @@ -90,7 +94,7 @@ def extract_substeps_from(dictionary:, current_step:, unvisited_transactions:) if sub_step["steps"].present? sub_step_steps = [] sub_step["steps"].each_with_object(sub_step_steps) do |st, array| - array << extract_substeps_from(dictionary: dictionary, current_step: st, unvisited_transactions: unvisited_transactions) + array << extract_substeps_from(dictionary:, current_step: st, unvisited_transactions:) end sub_step["steps"] = sub_step_steps