Showing 202 of 234 total issues
File referent.rb
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'i18n'
require 'truncate_to_db_limit'
# Note: There are a few actual attributes stored as Columns in referent --
# these were originally used for identifying a Referent identifying the
Method handle
has 66 lines of code (exceeds 25 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
Method gen_lamr_request
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def gen_lamr_request(request)
output = ""
builder = Builder::XmlMarkup.new(:target => output, :indent => 2)
builder.instruct!(:xml, :encoding => "UTF-8")
Method add_asin_service_responses
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def add_asin_service_responses(request, asin, item_url)
# we want to highlight Amazon to link to 'search in this book', etc.
if asin
# Search or Look inside the book offered? We only know by trying and
# then screen-scraping.
- 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 19 (exceeds 5 allowed). Consider refactoring. Open
def handle(request)
ids_processed = []
holdings_added = 0
if (@identifier_search && url = blacklight_precise_search_url(request) )
- 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 google_book_search.rb
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
class GoogleBookSearch < Service
require 'multi_json'
# Identifiers used in API response to indicate viewability level
Method normalize_params
has 62 lines of code (exceeds 25 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?
Method handle
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle(request)
scopus_query = scopus_query(request)
# we can't make a good query, nevermind.
return request.dispatched(self, true) if scopus_query.blank?
Method create_partial_volume_responses
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create_partial_volume_responses(request, ht_json)
items = ht_json.values.first["items"]
full_ids = items.collect do |i|
i["fromRecord"] if (is_serial_part?(i) && full_view?(i))
end.compact.uniq
- 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 do_query
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_query(request)
# get the search terms for use in both fulltext search and highlighted_link
# IA does index apostrophes, although not generally other puncutation. Need to keep em.
search_terms = {:title => get_search_title(request.referent ,:keep_apostrophes=>true),
:creator => get_search_creator(request.referent)}
Class SectionRenderer
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class SectionRenderer
include ActionView::Helpers::TagHelper
# First argument is the current umlaut Request object.
# Second argument is a session description hash. See class overview
Method to_citation
has 58 lines of code (exceeds 25 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
Method enhance_referent
has 57 lines of code (exceeds 25 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
Method freshen_dispatches!
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def freshen_dispatches!
umlaut_request.dispatched_services.each do | ds |
# go through dispatched_services and set still in progress but too long to failed temporary
if ( (ds.status == DispatchedService::InProgress ||
ds.status == DispatchedService::Queued ) &&
- 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 searchPath
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def searchPath(args = {})
args[:xml] = true if args[:xml].nil?
path = self.hip_base_url.path() + '?' "menu=search&aspect=power&npp=30&ipp=20&spp=20&profile=general&ri=2"
- 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 preempted_by
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def preempted_by(uml_request, for_type_generated=nil)
preempted_by = @preempted_by
return false if preempted_by.nil?
preempted_by = [preempted_by] unless preempted_by.kind_of?(Array)
preemption = 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
Class Bib
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Bib
attr_accessor :httpSession, :hip_base_url
# should have copies or items, not both
attr_accessor :bibNum, :copies, :items
attr_writer :title
Class Referent
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Referent < ActiveRecord::Base
# for shortcut metadata manipulations
include MetadataHelper
has_many :requests
Method handle
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle(request)
isbn = get_identifier(:urn, "isbn", request.referent)
issn = get_identifier(:urn, "issn", request.referent)
oclcnum = get_identifier(:info, "oclcnum", request.referent)
Method determine_coverage_boundaries
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def determine_coverage_boundaries(target)
# machine actionable coverage elements, used for collapsing
if (in_node = target.at_xpath("./coverage/in"))
year = in_node.at_xpath("year").try(:text).try(:to_i)
if year && year != 0
- 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"