team-umlaut/umlaut

View on GitHub
app/service_adaptors/hip_holding_search.rb

Summary

Maintainability
C
1 day
Test Coverage

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")
    
Severity: Minor
Found in app/service_adaptors/hip_holding_search.rb - About 7 hrs 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 90 lines of code (exceeds 25 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")
    
Severity: Major
Found in app/service_adaptors/hip_holding_search.rb - About 3 hrs to fix

    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                                            
    Severity: Major
    Found in app/service_adaptors/hip_holding_search.rb - About 45 mins to fix

      There are no issues that match your filters.

      Category
      Status