Showing 25 of 25 total issues
Method validate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def validate(record)
Array.wrap(options[:fields]).each do |field|
next unless record.respond_to?(field)
slugs = record.send(field).select { |id| id.start_with? 'slug:' }
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_assertions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_assertions(*)
object.controlled_properties.each do |property|
object[property].each do |value|
resource = value.respond_to?(:resource) ? value.resource : value
next unless resource.is_a?(ActiveTriples::Resource)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method transform_language_tagged_fields!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def transform_language_tagged_fields!(params)
return unless respond_to?(:language_tagged_fields)
language_tagged_fields.flatten.each do |field|
value_key = "#{field}_value"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method validate
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate(record)
fields.each do |field|
next unless record.respond_to?(field)
values = record.send(field)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method model_attributes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def model_attributes(form_params)
super.tap do |params|
terms.each do |key|
if params[key].is_a? Array
params[key] = params[key].map { |v| v.respond_to?(:strip) ? v.strip : v }.reject(&:blank?)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method default_terms
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def default_terms
%i[
id
title
title_alternative
Method find_renderer_class
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_renderer_class(name)
renderer = nil
['Renderer', 'AttributeRenderer'].each do |suffix|
const_name = "#{name.to_s.camelize}#{suffix}".to_sym
renderer =
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method generate_solr_document
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Confirmed
def generate_solr_document
super.tap do |doc|
# bibliographic_citation is a part of Spot::CoreMetadata, which is included on all works,
# but this should safeguard in the event that's not the case in the future
next doc unless object.respond_to?(:bibliographic_citation) && object.bibliographic_citation.present?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method clear_expired_embargoes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def clear_expired_embargoes(regenerate_thumbnails: false)
::Hyrax::EmbargoService.assets_with_expired_embargoes.each do |presenter|
item = ActiveFedora::Base.find(presenter.id)
next if item.under_embargo?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method manifest_metadata
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def manifest_metadata
metadata_fields.map do |field|
raw_values = send(field.to_sym)
next if raw_values.blank?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method content
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def content
::CSV.generate do |csv|
csv << terms.map do |term|
values = work.respond_to?(term) ? work.send(term) : ''
values = values.respond_to?(:to_a) ? values.to_a : [values]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method clear_expired_leases
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def clear_expired_leases(regenerate_thumbnails: false)
::Hyrax::LeaseService.assets_with_expired_leases.each do |presenter|
item = ActiveFedora::Base.find(presenter.id)
next if item.active_lease?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method append_to_solr_doc
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def append_to_solr_doc(solr_doc, solr_field_key, field_info, value)
return super unless object.controlled_properties.include?(solr_field_key.to_sym)
value_uri, value_label_hash = value.respond_to?(:solrize) ? value.solrize : [value, { label: value }]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_english_language_dates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_english_language_dates(solr_doc)
solr_doc[english_language_date_field] = dates.map do |date|
begin
parsed = Date.parse(date)
rescue ArgumentError
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method store_years_encompassed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def store_years_encompassed(doc)
raw_values = [:date, :date_associated].map { |s| object.send(s) }.map(&:to_a).flatten
years = raw_values.reduce([]) do |dates, date|
parsed = Date.edtf(date)
next (dates + [parsed.year]) if parsed.is_a? Date
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate(record)
authority_name = options[:authority]
field = options[:field]
authority = authority_for(authority_name)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method load_and_authorize_resource
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_and_authorize_resource
search_params = params
search_params.delete :page
search_params.delete :type
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add_rights_statement_label
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_rights_statement_label(doc)
doc[value_key] ||= []
doc[label_key] ||= []
doc[shortcode_key] ||= []
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method build_field_options
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_field_options(value, _index)
return super if defined?(super)
dom_id = input_dom_id if respond_to?(:input_dom_id)
dom_id ||= "#{object_name}_#{attribute_name}"
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method add
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add(env, id)
collection = ::Collection.find(id)
return unless env.current_ability.can?(:deposit, collection)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"