team-umlaut/umlaut

View on GitHub

Showing 236 of 236 total issues

Method get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get(path, headers=nil, &block)
      limit = 6
      tries = 0
      response = nil

Severity: Minor
Found in app/models/hip3/bib_searcher.rb - About 25 mins to fix

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 extract_works has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_works(doc)
    works = []
    doc.search("by/citation/title").each_with_index do |t, i|
      works << t.inner_text
      break if @num_of_works == i + 1
Severity: Minor
Found in app/service_adaptors/worldcat_identities.rb - About 25 mins to fix

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 blacklight_precise_search_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def blacklight_precise_search_url(request, format = "marc")

    # Add search clauses for our identifiers, if we have them and have a configured search field for them. 
    clauses = []
    added = []
Severity: Minor
Found in app/service_adaptors/blacklight.rb - About 25 mins to fix

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 link_out_filter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def link_out_filter(orig_url, service_response, other_args = {})
    # remove trailing or leading whitespace from url, it makes it
    # an illegal URL anyway, but maybe we can rescue it? Marc 856's
    # sometimes have accidental trailing whitespace. 
    orig_url = orig_url.strip
Severity: Minor
Found in app/service_adaptors/ezproxy.rb - About 25 mins to fix

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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(config)
    config.each do | key, val |
      self.instance_variable_set(('@'+key).to_sym, val)
    end

Severity: Minor
Found in app/service_adaptors/service.rb - About 25 mins to fix

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 openurl_date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def openurl_date(date_xml)
    date = ""
    
    if y = date_xml.at("Year")
      date << ("%04d" % y.inner_text.strip[0,4].to_i )
Severity: Minor
Found in app/service_adaptors/pubmed.rb - About 25 mins to fix

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_like_headers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def proxy_like_headers(request, host = nil)
    orig_env = request.http_env
    if (request.http_env.nil? || ! request.http_env.kind_of?(Hash))
      Rails.logger.warn("proxy_like_headers: orig_env arg is missing, proxy-like headers will be flawed. request id: #{request.id}. ")
      orig_env = {}
Severity: Minor
Found in app/mixin_logic/umlaut_http.rb - About 25 mins to fix

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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(config)
    # defaults
    @url = 'http://webservices.amazon.com/onca/xml'     
    @reader_base_url = 'http://www.amazon.com/gp/reader/'
    @display_name = "Amazon.com"
Severity: Minor
Found in app/service_adaptors/amazon.rb - About 25 mins to fix

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_types_in_progress? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def service_types_in_progress?(type_array)
    # convert strings to ServiceTypeValues
    type_array = type_array.collect {|s|  s.kind_of?(ServiceTypeValue)? s : ServiceTypeValue[s] }
    
    self.services_in_progress.each do |s|
Severity: Minor
Found in app/models/request.rb - About 25 mins to fix

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 set_values_from_context_object has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def set_values_from_context_object(co)
    rft = co.referent
  
    # Multiple identifiers are possible! 
    rft.identifiers.each do |id_string|
Severity: Minor
Found in app/models/referent.rb - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def handle(umlaut_request)
    
    isbn = get_isbn(umlaut_request.referent)

    # remove hyphens, some services don't like them.
Severity: Minor
Found in app/service_adaptors/isbn_link.rb - About 25 mins to fix

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_types_generated has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def service_types_generated
    types= []

    if @web_links
      types.push ServiceTypeValue[:highlighted_link]
Severity: Minor
Found in app/service_adaptors/google_book_search.rb - About 25 mins to fix

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_identifiers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_identifiers(rft)
    isbn = get_identifier(:urn, "isbn", rft)
    oclcnum = get_identifier(:info, "oclcnum", rft)
    lccn = get_identifier(:info, "lccn", rft)
    
Severity: Minor
Found in app/service_adaptors/open_library.rb - About 25 mins to fix

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 set_keywords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def set_keywords(arg_kw, args={})

      arg_kw = [] if arg_kw.nil?
      args[:index] = :general unless args[:index]

Severity: Minor
Found in app/models/hip3/bib_searcher.rb - About 25 mins to fix

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 extract_cover_image_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_cover_image_link(request, citation)
    cover = citation.at("cover")
    return nil unless cover
    # we try not to show a cover if we already probably have the same cover 
    # showing.
Severity: Minor
Found in app/service_adaptors/worldcat_identities.rb - About 25 mins to fix

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 score_metadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def score_metadata(edition)
    oclcnum = edition["oclc_numbers"].collect {|i| i.to_i}.max unless edition["oclc_numbers"].blank?
    oclcnum = nil if oclcnum == 0

    score = 0
Severity: Minor
Found in app/service_adaptors/open_library.rb - About 25 mins to fix

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 gather_services has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def gather_services
    @service_definitions_flat.each_pair do | unique_id, svc_def |
      next if svc_def.nil?

      svc_def['service_id'] = unique_id
Severity: Minor
Found in app/models/collection.rb - About 25 mins to fix

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 init_processing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def init_processing    
    # intentionally trigger creation of session if it didn't already exist
    # because we need to track session ID for caching. Can't find any
    # way to force session creation without setting a value in session,
    # so we do this weird one.
Severity: Minor
Found in app/controllers/resolve_controller.rb - About 25 mins to fix

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 guarded has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def guarded(section, &block)
        if (options[:only].nil? || options[:only].include?(section.to_s)) &&
           (options[:except].nil? || ! options[:except].include?(section.to_s))
          yield
        else
Severity: Minor
Found in lib/generators/umlaut/install_generator.rb - About 25 mins to fix

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 assert_service_responses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def assert_service_responses(request, service_id, options = {})
      number = options[:number]
      type_names  = Array(options[:includes_type])

      responses = request.service_responses.to_a.find_all {|r| r.service_id == service_id}
Severity: Minor
Found in lib/umlaut/test_help.rb - About 25 mins to fix

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

Severity
Category
Status
Source
Language