Showing 15 of 26 total issues
File catalog_controller.rb
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
class CatalogController < ApplicationController
include BlacklightAdvancedSearch::Controller
helper Openseadragon::OpenseadragonHelper
include Blacklight::Catalog
File dor_config.rb
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'macros/general'
require_relative 'macros/dor'
require 'active_support/core_ext/object/blank'
extend Traject::Macros::General
Method page_entries_info
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def page_entries_info(collection, entry_name: nil)
entry_name = if entry_name
entry_name.pluralize(collection.size, I18n.locale)
else
collection.entry_name(count: collection.size).to_s.downcase
Method add_thumbnail_url
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_thumbnail_url
return unless thumbnail_field
# if a thumbnail service is available
image = manifest['thumbnail'] if iiif_thumbnail_service?(manifest['thumbnail'])
- 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 extract_geonames_ids
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def extract_geonames_ids(sdb)
sdb.smods_rec.subject.map do |z|
next unless z.geographic.any?
uri = z.geographic.attr('valueURI')
- 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 extract_annotations_from_list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def extract_annotations_from_list(accumulator, url)
annotation_list = JSON.parse(Faraday.get(url).body)
return unless annotation_list['@type'] == 'sc:AnnotationList' && annotation_list['resources']
annotation_list['resources'].each do |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 page_entries_info
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def page_entries_info(collection, entry_name: nil)
entry_name = if entry_name
entry_name.pluralize(collection.size, I18n.locale)
else
collection.entry_name(count: collection.size).to_s.downcase
- 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
Function init
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function (el) {
var _this = this;
var $el = $(el);
var data = $el.data();
$.getJSON(data.path, {
Method resource_images_iiif_urls
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def resource_images_iiif_urls
lambda do |resource, accumulator, _context|
content_metadata = resource.public_xml.at_xpath('/publicObject/contentMetadata')
next if content_metadata.nil?
- 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 flatten_top_level
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def flatten_top_level(attributes)
flatten = %w(
id modsxml druid last_updated url_fulltext display_type collection_type
author_1xx_search
title_245_search title_245a_display title_245a_search title_display title_sort
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(id, iiif_id, label, annotation_lists, annotations)
Method extract_canvas_annotation_list_urls
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract_canvas_annotation_list_urls
lambda do |record, accumulator, _context|
return if record['otherContent'].blank?
record['otherContent'].each do |link|
- 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 extract_canvas_annotations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def extract_canvas_annotations
lambda do |record, accumulator, _context|
return if record['otherContent'].blank?
record['otherContent'].each do |link|
- 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 as_json
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def as_json(*)
@exhibits.map do |exhibit|
thumbnail_url = exhibit&.thumbnail&.iiif_url
if thumbnail_url&.start_with?('/')
host = Settings.action_mailer.default_url_options.host
- 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 indexable_resources
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def indexable_resources
return to_enum(:indexable_resources) { size } unless block_given?
resources.each do |resource|
yield 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"