Showing 202 of 234 total issues
Method gen_lamr_request
has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring. Open
def gen_lamr_request(request)
output = ""
builder = Builder::XmlMarkup.new(:target => output, :indent => 2)
builder.instruct!(:xml, :encoding => "UTF-8")
- 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 enhance_referent
has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring. Open
def enhance_referent(marc, request, accuracy)
return unless accuracy > 2
title_key = case request.referent.format
when "book" then "btitle"
- 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 parse_response
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def parse_response(resolver_response, request)
doc = Nokogiri::XML(resolver_response)
# Catch an SFX error message (in HTML) that's not an XML
# document at all.
- 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_856_links
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
def add_856_links(request, marc_records, options = {})
options[:default_service_type] ||= "fulltext"
options[:match_reliability] ||= ServiceResponse::MatchExact
responses_added = Hash.new
- 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 handle
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def handle(request, session_id)
return if (@services.nil? || @services.empty?)
bundle_start = Time.now
Rails.logger.info(TermColor.color("Umlaut: Launching service wave #{@priority_level} #{'(non-threaded)' unless config.lookup!("threaded_service_wave", true) }", :yellow) + ", request #{request.id}") if @log_timing
- 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 handle
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def handle(request)
# Only do anything if we have no holdings results from someone else.
holdings = request.service_types.where(:service_type_value_name => "holding")
- 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 enhance_referent
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def enhance_referent(body, request)
doc = Nokogiri::XML(body)
return unless cite = doc.at("PubmedArticleSet/PubmedArticle/MedlineCitation") # Nothing of interest here
return unless article = cite.at("Article") # No more useful metadata
- 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
File worldcat_identities.rb
has 473 lines of code (exceeds 250 allowed). Consider refactoring. Open
class WorldcatIdentities < Service
require 'open-uri' # SRU is too slow even though we use an SRU-like link
require 'nokogiri'
include MetadataHelper
Method check_holdings
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def check_holdings(holdings, request)
return if holdings.empty?
# These need to moved to services.yml
electronic_locations = ['INTERNET', 'NETLIBRARY', 'GALILEO']
holdings.each do | holding |
- 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 normalize_params
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def normalize_params
# citation search params
# sfx.title_search and umlaut.title_search_type are synonyms
params["sfx.title_search"] = params["umlaut.title_search_type"] if params["sfx.title_search"].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
File sfx.rb
has 425 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Sfx < Service
require 'uri'
require 'htmlentities'
require 'cgi'
require 'nokogiri'
Method set_default_configuration!
has 145 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.set_default_configuration!(configuration)
configuration.configure do
app_name 'Find It'
# Different navbar title? Defaults to app_name
header_title deferred! {|c| c.app_name}
Method parse_response
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_response(resolver_response, request)
doc = Nokogiri::XML(resolver_response)
# Catch an SFX error message (in HTML) that's not an XML
# document at all.
Method to_citation
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def to_citation
citation = {}
# call self.metadata once and use the array for efficiency, don't
# keep calling it. profiling shows it DOES make a difference.
my_metadata = self.metadata
- 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_aws_service_responses
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def add_aws_service_responses(request, aws_response)
return_hash = Hash.new
aws = Nokogiri::XML(aws_response.body)
# extract and collect info from the xml
- 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 edition_statement
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def edition_statement(marc, options = {})
options[:include_repro_info] ||= true
options[:exclude_533_fields] = ['7','f','b', 'e']
parts = Array.new
- 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 create_by_context_object
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def self.create_by_context_object(co, options = {})
self.clean_up_context_object(co)
rft = Referent.new
- 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 enhance_metadata
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def enhance_metadata(referent, editions)
# Which one should we use to enhance? Whichever has the largest
# oclcnum, or if none of them have an oclcnum, then whichever
# has the most metadata elements.
winner = 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 enhance_referent
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
def enhance_referent(marc, request, accuracy)
return unless accuracy > 2
title_key = case request.referent.format
when "book" then "btitle"
Method enhance_referent
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def enhance_referent(request, perl_data)
ActiveRecord::Base.connection_pool.with_connection do
metadata = request.referent.metadata
- 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"