team-umlaut/umlaut

View on GitHub

Showing 236 of 236 total issues

Method get_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def get_data(request)
    ids = get_identifiers(request.referent)
    return nil if ids.blank?
    ol_keys = do_id_query(ids)    
    return nil if ol_keys.blank?
Severity: Minor
Found in app/service_adaptors/open_library.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 handle has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def handle(request)
    ids = {
      :isbn => request.referent.isbn,
      :oclc => request.referent.oclcnum,
      :lccn => request.referent.lccn
Severity: Minor
Found in app/service_adaptors/open_library_cover.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 get_parameters has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def get_parameters(rft)
    # API supports oclcnum, isbn, or lccn, and can provide more than one of each. 
    get_bibkey_parameters(rft) do |isbn, lccn, oclcnum|         
      keys = Array.new
                  
Severity: Minor
Found in app/service_adaptors/hathi_trust.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_copies has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def add_copies(request, bib_array, options = {})
    #debugger
    
    # default    
    options[:match_reliability] ||= ServiceResponse::MatchExact
Severity: Minor
Found in app/service_adaptors/hip3_service.rb - About 1 hr to fix

    Function success has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                 success: function(umlaut_response) {
                  for (var i = 0; i < myself.section_targets.length; i++) {
                      var section_target = myself.section_targets[i];                                
                     
                      var umlaut_html_section = myself.find_umlaut_response_section(umlaut_response, section_target.umlaut_section_id);
    Severity: Minor
    Found in app/assets/javascripts/umlaut/update_html.js - About 1 hr to fix

      Method parse_perl_data has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.parse_perl_data(doc)
      
          co = OpenURL::ContextObject.new
          co.referent.set_format('journal') # default
      
      
      Severity: Minor
      Found in app/service_adaptors/sfx.rb - About 1 hr to fix

        Method gen_lamr_request has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def gen_lamr_request(request)
            output = ""
            
            builder = Builder::XmlMarkup.new(:target => output, :indent => 2)
            builder.instruct!(:xml, :encoding => "UTF-8")    
        Severity: Minor
        Found in app/service_adaptors/jcr.rb - About 1 hr to fix

          Method illiad_query_parameters has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def illiad_query_parameters(request)
              metadata = request.referent.metadata
          
              qp = {}
          
          
          Severity: Minor
          Found in app/service_adaptors/illiad.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 scopus_search has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              def scopus_search(request)
                
                if (doi = get_doi(request.referent))
                  return CGI.escape( "DOI(#{phrase(doi)})" )
                elsif (pmid = get_pmid(request.referent))
            Severity: Minor
            Found in app/service_adaptors/scopus.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 find_or_create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.find_or_create(params, session, a_rails_request, options = {} )
            
            
            
                # Pull out the http params that are for the context object,
            Severity: Minor
            Found in app/models/request.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 scopus_query has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

              def scopus_query(request)
                
                if (doi = get_doi(request.referent))
                  return "DOI(#{phrase(doi)})"
                elsif (pmid = get_pmid(request.referent))
            Severity: Minor
            Found in app/service_adaptors/scopus2.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 check_holdings has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def check_holdings(holdings, request)      
                return if holdings.empty?
                # These need to moved to services.yml
                electronic_locations = ['INTERNET', 'NETLIBRARY', 'GALILEO']
                holdings.each do | holding | 
            Severity: Minor
            Found in app/service_adaptors/opac.rb - About 1 hr to fix

              Method define_query has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def define_query(rft)
                  oclcnum = get_identifier(:info, "oclcnum", rft)
                  metadata = rft.metadata
                  
                  # Do we have enough info to do a query with sufficient precision?
              Severity: Minor
              Found in app/service_adaptors/worldcat_identities.rb - About 1 hr to fix

                Method check_proxy_urls has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def check_proxy_urls(urls)
                    url_doc = REXML::Document.new
                    doc_root = url_doc.add_element "proxy_url_request", {"password"=>@proxy_password}
                    urls_elem = doc_root.add_element "urls"
                    urls.each { | link |
                Severity: Minor
                Found in app/service_adaptors/ezproxy.rb - About 1 hr to fix

                  Method add_responses has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def add_responses(request, response_xml)
                  
                      results = response_xml.at('map[@name ="cite_id"] map[@name="WOS"]')
                      unless (results)
                        error_message = "#{self.id}: "
                  Severity: Minor
                  Found in app/service_adaptors/isi.rb - About 1 hr to fix

                    Method create_partial_volume_responses has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def create_partial_volume_responses(request, ht_json)
                        items =  ht_json.values.first["items"]
                        full_ids = items.collect do |i| 
                          i["fromRecord"] if (is_serial_part?(i) && full_view?(i))
                        end.compact.uniq
                    Severity: Minor
                    Found in app/service_adaptors/hathi_trust.rb - About 1 hr to fix

                      Method roll_up_responses has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def roll_up_responses(list, options = {})
                          options = options.reverse_merge(:coverage_sensitive => true)
                      
                          prefixes = @roll_up_prefixes
                      
                      
                      Severity: Minor
                      Found in app/service_adaptors/sfx.rb - About 1 hr to fix

                        Method create_new_request! has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def self.create_new_request!( args )
                        
                            # all of these are required
                            params = args[:params]
                            session = args[:session]
                        Severity: Minor
                        Found in app/models/request.rb - About 1 hr to fix

                          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
                            Severity
                            Category
                            Status
                            Source
                            Language