Showing 202 of 234 total issues
Method create_by_context_object
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_by_context_object(co, options = {})
self.clean_up_context_object(co)
rft = Referent.new
Method enhance_referent
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def enhance_referent(key, value, metadata=true, private_data=false, options = {})
ActiveRecord::Base.connection_pool.with_connection do
return if value.nil?
Method list_with_limit
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list_with_limit(id, list, options = {}, &block)
# backwards compatible to when third argument was just a number
# for limit.
options = {:limit => options} unless options.kind_of?(Hash)
options[:limit] ||= 5
Method find_by_group
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_by_group
connection = sfx4_db_connection
from_where_clause = %{
FROM
AZ_TITLE T
Consider simplifying this complex logical expression. Open
if (other_type == "*")
# Need to check dispatched services instead of service_types,
# as we pre-empt even if no services created.
preemption =
uml_request.dispatched_services.to_a.find do |disp|
Consider simplifying this complex logical expression. Open
if ( oclcnum.blank? && ( metadata['aulast'].blank? || metadata['aufirst'].blank? ) && metadata['au'].blank? && metadata['aucorp'].blank? ) or (oclcnum.blank? && @require_identifier)
Rails.logger.debug("Worldcat Identities Service Adaptor: Skipped: Insufficient metadata for lookup")
return nil
end
Method search
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def search
return [] if insufficient_query
httpResp = httpSession.get(searchPath(), 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 index
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def index
perm = Permalink.where(:id => params[:id]).first
handle_404_error and return unless perm # not in our db
co = OpenURL::ContextObject.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 title
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def title
unless (@title)
# title may already have been lazily loaded, or loaded by the
# bibsearcher. Otherwise, we need to extract it from the bib_xml,
# which is kind of a pain.
- 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_str
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def edition_str(result)
edition_str = ""
edition_str << result['title'] unless result['title'].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 parse_field
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_field(str, first, last)
list = str.split(",")
list.map!{|r|
r, every = r.split("/")
every = every ? every.to_i : 1
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
def handle(request)
image_url = image_url(request.referent)
return request.dispatched(self, true) unless image_url
uri = URI.parse(image_url)
- 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 clean_up_context_object
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.clean_up_context_object(co)
# First, remove any empty DOIs! or other empty identifiers?
# LOTS of sources send awful empty identifiers.
# That's not a valid identifier!
empty_ids = co.referent.identifiers.find_all { |i| i =~ Regexp.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 expand_contract_section
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def expand_contract_section(arg_heading, id, options={}, &block)
expanded = (params["umlaut.show_#{id}"] == "true") || options[:initial_expand] || false
icon = content_tag(:i, nil, :class => [] << ( expanded ? "umlaut_icons-list-open" : "umlaut_icons-list-closed"))
heading = content_tag(:span,( expanded ? "Hide " : "Show "), :class=>'expand_contract_action_label') + arg_heading
body_class = (expanded ? "in" : "")
- 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 context_object_params
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.context_object_params(a_rails_request)
# GET params
co_params = CGI::parse( a_rails_request.query_string )
# add in the POST params please
- 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 sfx_controls_url?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.sfx_controls_url?(url)
ActiveRecord::Base.connection_pool.with_connection do
# Does it match any of our supplementary configged strings or regexps?
UmlautController.umlaut_config.lookup!("sfx.additional_sfx_controlled_urls", []).each do |test|
# '===' will match a regexp or equality on a string
- 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 service_type_for_856
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def service_type_for_856(field, options)
options[:default_service_type] ||= "fulltext_title_level"
# LC records here at hopkins have "Table of contents only" in the 856$3
# Think that's a convention from LC?
- 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 get_years
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_years(marc)
array = []
# no marc 008? Weird, but okay.
return array unless marc['008']
- 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 to_context_object
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_context_object(context_object)
ctx = OpenURL::ContextObject.new
# Start out wtih everything in search, to preserve date/vol/etc
ctx.import_context_object(context_object)
# Put SFX object id in rft.object_id, that's what SFX does.
- 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_headers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_headers(request)
original_forwarded_for = nil
if (request.http_env && request.http_env['HTTP_X_FORWARDED_FOR'])
original_forwarded_for = request.http_env['HTTP_X_FORWARDED_FOR']
end
- 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"