Skip to content

Commit

Permalink
Addresses rubocop violations
Browse files Browse the repository at this point in the history
  • Loading branch information
LaRita Robinson committed Jan 22, 2024
1 parent 8f49a49 commit 5925c63
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/forms/hyrax/forms/pcdm_collection_form_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# # frozen_string_literal: true
# frozen_string_literal: true

Hyrax::Forms::PcdmCollectionForm.class_eval do
include Hyrax::FormFields(:basic_metadata)
Expand Down
2 changes: 2 additions & 0 deletions app/indexers/concerns/hyku_indexing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ 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
solr_doc['bulkrax_identifier_tesim'] = object.bulkrax_identifier if object.respond_to?(:bulkrax_identifier)
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
Expand Down
3 changes: 1 addition & 2 deletions app/services/hyrax/permission_manager_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 11 additions & 7 deletions lib/hyrax/transactions/grapher.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module Hyrax
module Transactions
##
Expand All @@ -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<String, 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
Expand All @@ -35,9 +37,10 @@ def initialize(container: )
# @return [Hash<String,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 = {}
Expand Down Expand Up @@ -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 }
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5925c63

Please sign in to comment.