team-umlaut/umlaut

View on GitHub
app/service_adaptors/blacklight.rb

Summary

Maintainability
C
1 day
Test Coverage

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) )
Severity: Minor
Found in app/service_adaptors/blacklight.rb - About 2 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 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def handle(request)
    ids_processed = []
    holdings_added = 0
    
    if (@identifier_search && url = blacklight_precise_search_url(request) )
Severity: Minor
Found in app/service_adaptors/blacklight.rb - About 1 hr to fix

    Method blacklight_keyword_search_url has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

      def blacklight_keyword_search_url(request, options = {})
        options[:format] ||= "atom"
        options[:content_format] ||= "marc"
        
        clauses = []
    Severity: Minor
    Found in app/service_adaptors/blacklight.rb - About 1 hr 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 add_holdings has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def add_holdings(holdings_url, options = {})
        options[:match_reliability] ||= ServiceResponse::MatchExact
        options[:marc_data] ||= {}
        
        atom = Nokogiri::XML( http_fetch(holdings_url).body )
    Severity: Minor
    Found in app/service_adaptors/blacklight.rb - About 1 hr to fix

      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']     
      Severity: Minor
      Found in app/service_adaptors/blacklight.rb - About 45 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

      There are no issues that match your filters.

      Category
      Status