Showing 202 of 234 total issues
Method get_sudoc
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_sudoc(rft)
# Don't forget to unescape the sudoc that was escaped to maek it a uri!
# Option 1: In a technically illegal but oh well info:sudoc uri
- 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 resolver_link
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def resolver_link(context_object, params={})
# Content of the link.
if ( umlaut_config.link_img_url && params[:text].blank? )
link_content = image_tag(umlaut_config.link_img_url, :border=>0, :alt=>umlaut_config.app_name)
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def handle(request)
isbn = request.referent.metadata['isbn']
isbn = isbn.gsub(/[^0-9X]/,'') if isbn
- 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 filter_keyword_entries
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def filter_keyword_entries(request, atom_entries, options = {})
options[:exclude_ids] ||= []
options[:remove_subtitle] ||= true
title = request.referent['jtitle']
- 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
Avoid deeply nested control flow statements. Open
if (req_bibnum == bib.bibNum)
responses_added.merge!( add_856_links(request, [bib.marc_xml]) )
responses_added.merge!( add_copies( request, [bib] ))
matches.delete(bib)
end
Avoid deeply nested control flow statements. Open
if request.referent.metadata["volume"] == evol
copy_match = true
elsif request.referent.metadata["volume"].to_i > svol.to_i and request.referent.metadata["volume"].to_i < evol.to_i
copy_match = true
end
Method illiad_query_parameters
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def illiad_query_parameters(request)
metadata = request.referent.metadata
qp = {}
- 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
Avoid deeply nested control flow statements. Open
request.referent.enhance_referent('format', 'journal', false) unless request.referent.format == 'journal'
Method test_with_cassette
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def test_with_cassette(name, group = nil, vcr_options ={}, &block)
# cribbed from Rails and modified for VCR
# https://github.com/rails/rails/blob/b451de0d6de4df6bc66b274cec73b919f823d5ae/activesupport/lib/active_support/testing/declarative.rb#L25
test_name_safe = name.gsub(/\s+/,'_')
- 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
Avoid deeply nested control flow statements. Open
if metadata["atitle"]
request.referent.enhance_referent('genre', 'article')
elsif metadata["issue"]
request.referent.enhance_referent('genre', 'issue')
else
Method enhance_referent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def enhance_referent(key, value, metadata=true, private_data=false, options = {})
Method config
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def config
# cache hash loaded from YAML, ensure it has the keys we expect.
unless defined? @services_config_list
yaml_path = File.expand_path("config/umlaut_services.yml", Rails.root)
- 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 proxy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def proxy
svc_resp = ServiceResponse.find(params[:id])
url_str = svc_resp.view_data[:url]
uri = nil
begin
- 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 co_params_fingerprint
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.co_params_fingerprint(params)
# Don't use ctx_time, consider two co's equal if they are equal but for ctx_tim.
# exclude cache-busting "_" key that JQuery adds. Fine to bust HTTP cache, but
# don't want to it to force new Umlaut processing.
- 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 calculate_url_for_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def calculate_url_for_response(svc_response)
svc = ServiceStore.instantiate_service!(svc_response.service_id, nil)
destination = svc.response_url(svc_response, params)
raise_missing_url!(svc_response) if destination.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 render_service_credits
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def render_service_credits
if @collection
content = "".html_safe
content << t('umlaut.misc.powered_by_umlaut').html_safe + " " + link_to("Umlaut", "https://github.com/team-umlaut/umlaut") + ". ".html_safe
- 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_download_link
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_download_link(request, editions)
return nil unless editions
ed = editions[0] if editions.length
return nil unless ed['ocaid']
server = "www.archive.org"
- 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_service_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_service_response(response_data)
raise ArgumentError.new("missing required `:service` key") unless response_data[:service].kind_of?(Service)
raise ArgumentError.new("missing required `:service_type_value` key") unless response_data[:service_type_value]
- 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 send_txt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_txt
@number = params[:number]
# Remove any punctuation or spaces etc
@number.gsub!(/[^\d]/, '') if @number
@provider = params[:provider]
- 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 calc_highlighted_sections!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def calc_highlighted_sections!
sections = []
if umlaut_request.get_service_type("fulltext").present?
sections << "fulltext"
- 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"