Showing 24 of 39 total issues
Function SpecialRequestLink
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
const SpecialRequestLink = ({ holding, locationText }) => {
const [hasData, setHasData] = useState(false);
const [showSpinner, setShowSpinner] = useState(true);
const [url, setUrl] = useState('#');
const { catkey } = holding;
- Read upRead up
- Create a ticketCreate a ticket
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
File index.js
has 456 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @file
* Real Time Availability
*/
- Create a ticketCreate a ticket
File catalog_controller.rb
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
class CatalogController < ApplicationController
include BlacklightAdvancedSearch::Controller
include BlacklightRangeLimit::ControllerOverride
include Blacklight::Catalog
include Blacklight::Configurable
- Create a ticketCreate a ticket
Function loadAvailability
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
loadAvailability() {
const titleIDs = [];
const summaryHoldings = {};
// Get the catkeys
- Create a ticketCreate a ticket
Function processBoundParents
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
processBoundParents(boundHoldings, allHoldings, summaryHoldings) {
const catkeys = Object.keys(boundHoldings);
let itemIDs = [];
$.each(catkeys, (i, catkey) => {
- Create a ticketCreate a ticket
Function blCheckboxSubmit
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.blCheckboxSubmit = function (argOpts) {
this.each(function () {
const options = $.extend({}, $.fn.blCheckboxSubmit.defaults, argOpts);
const form = $(this);
- Create a ticketCreate a ticket
Class SolrManager
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class SolrManager
ALLOWED_TIME_TO_RESPOND = 30
attr_reader :config
- Create a ticketCreate a ticket
Function availabilityDisplay
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
availabilityDisplay(allHoldings, summaryHoldings) {
$('.availability').each(function () {
const availabilityHTML = $(this);
const catkey = availabilityHTML.data('keys');
const isOnlineOnOrderOnly = availabilityHTML.data('isOnlineOnOrderOnly');
- Create a ticketCreate a ticket
Function setGooglePreview
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export default function setGooglePreview() {
const element = document.getElementById('google-preview');
const urlComponents = {
googlePreviewUrl: '/links/google-preview-data',
searchItem: element?.dataset?.searchItem,
- Read upRead up
- Create a ticketCreate a ticket
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 getBoundHoldings
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
getBoundHoldings(boundHoldings, titleInfo) {
boundHoldings[titleInfo.catkey] = [];
titleInfo.jQueryObj.children('BoundwithLinkInfo').each(function () {
const linkedAsParent = $(this).children('linkedAsParent').text();
- Create a ticketCreate a ticket
Function clicked
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
async clicked() {
for (let i = 0; i < this.forms.length; i += 1) {
if (!this.checked(i)) {
this.forms[i].querySelector('span').innerHTML =
this.forms[i].getAttribute('data-inprogress');
- Create a ticketCreate a ticket
Function setGooglePreview
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function setGooglePreview() {
const element = document.getElementById('google-preview');
const urlComponents = {
googlePreviewUrl: '/links/google-preview-data',
searchItem: element?.dataset?.searchItem,
- Create a ticketCreate a ticket
Method get_item_location_data
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_item_location_data(holding)
item_location_data = []
if holding['ItemInfo'].is_a?(Array)
holding['ItemInfo'].each do |item|
if item_location_data.size >= 3
- Read upRead up
- Create a ticketCreate a ticket
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 index
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
cache_key = nil
# No other params presents indicates we are on the homepage
if params.keys.eql? %w[controller action]
cache_key = "#{params['controller']}/#{params['action']}facet_query"
- Create a ticketCreate a ticket
Function availabilityDataStructurer
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
availabilityDataStructurer(holdingMetadata) {
const availabilityStructuredData = [];
let holdingData = [];
let pluralize = '';
let library = '';
- Create a ticketCreate a ticket
Method url
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def url
url_opts = @url_opts.merge(({ id: @document } if @document) || {})
if @action.path
helpers.public_send(@action.path, url_opts)
elsif url_opts[:id].class.respond_to?(:model_name)
- Read upRead up
- Create a ticketCreate a ticket
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 follow_redirects
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def follow_redirects(url)
host = URI.parse(url).host
# Skip any further redirect business if we already know that we're going to get a
# response with good CORS headers.
- Read upRead up
- Create a ticketCreate a ticket
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 get_data_from_call_info
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_data_from_call_info(call_info)
availability = []
call_info.each do |holding|
if availability.size >= 30
@view_more = true
- Read upRead up
- Create a ticketCreate a ticket
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 clicked
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async clicked() {
for (let i = 0; i < this.forms.length; i += 1) {
if (!this.checked(i)) {
this.forms[i].querySelector('span').innerHTML =
this.forms[i].getAttribute('data-inprogress');
- Read upRead up
- Create a ticketCreate a ticket
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 login
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def login
session[:groups] = request.env.fetch(Settings.groups_header, '').split(',')
redirect_location = params['fullpath'] || stored_location_for(User) || '/'
if current_user
flash[:success] = I18n.t('blackcat.successful_login')
- Read upRead up
- Create a ticketCreate a ticket
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"