team-umlaut/umlaut

View on GitHub

Showing 202 of 234 total issues

Method add_asin_service_responses has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def add_asin_service_responses(request, asin, item_url)
    # we want to highlight Amazon to link to 'search in this book', etc.
    if asin
      # Search or Look inside the book offered? We only know by trying and
      # then screen-scraping.
Severity: Major
Found in app/service_adaptors/amazon.rb - About 2 hrs to fix

    Function update has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.update = function() {
          // Need to capture because we won't have 'this' inside the ajax
          // success handler. 
          var myself = this;       
          var dataType = this.is_remote_url( this.umlaut_uri ) ? "jsonp" : "json";
    Severity: Minor
    Found in app/assets/javascripts/umlaut/update_html.js - About 2 hrs to fix

      Method included has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def self.included(klass)
              klass.class_eval do
                self.table_name = 'AZ_TITLE'
                self.primary_key = 'AZ_TITLE_ID'
      
      
      Severity: Minor
      Found in app/models/sfx4/abstract/az_title.rb - About 2 hrs to fix

        Method handle has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def handle(request)
            scopus_search = scopus_search(request)
        
            # we can't make a good query, nevermind. 
            return request.dispatched(self, true) if scopus_search.blank? 
        Severity: Minor
        Found in app/service_adaptors/scopus.rb - About 2 hrs to fix

          Method add_856_links has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def add_856_links(request, marc_records, options = {})
              options[:default_service_type] ||= "fulltext"
              options[:match_reliability] ||= ServiceResponse::MatchExact
          
              responses_added = Hash.new
          Severity: Minor
          Found in app/mixin_logic/marc_helper.rb - About 1 hr to fix

            Method define_query has a Cognitive Complexity of 15 (exceeds 5 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

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

              def get_identifier(type, sub_scheme, referent, options = {} )
                options[:multiple] ||= false
                
                raise Exception.new("type must be :urn or :info") unless type == :urn or type == :info
            
            
            Severity: Minor
            Found in app/mixin_logic/metadata_helper.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 enhance_referent has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def enhance_referent(request, data)
                
                entry = data["items"].first
                
            
            
            Severity: Minor
            Found in app/service_adaptors/google_book_search.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 excluded? has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def excluded?(url)    
                return false if @exclude.blank?
                
                @exclude.each do |entry|
                  if ((entry[0,1] == '/') && (entry[entry.length()-1 ,1 ] == '/'))
            Severity: Minor
            Found in app/service_adaptors/ezproxy.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 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def handle(request)
                isbn = get_identifier(:urn, "isbn", request.referent)
                issn = get_identifier(:urn, "issn", request.referent)
                oclcnum = get_identifier(:info, "oclcnum", request.referent)
                
            Severity: Minor
            Found in app/service_adaptors/worldcat.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 nature_of_contents has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def nature_of_contents(marc)
                types = {'m'=>'dissertation','t'=>'report','j'=>'patent'}
                idx = nil
                if self.record_type(marc) == 'BKS'
                  idx = 24
            Severity: Minor
            Found in app/service_adaptors/opac.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 fetch_urls has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def fetch_urls
                    # Crazy crazy URLs to try to find PARSE_PARAMS in Sfx4 db that have a period in
                    # them, so they look like they might be URLs. Parse params could be at target service
                    # level, or at portfolio level; and could be in local overrides or in global kb. 
                    # This is crazy crazy SQL to get this, sorry. Talking directly to SFX db isn't
            Severity: Minor
            Found in app/models/sfx4/abstract/base.rb - About 1 hr to fix

              Method enhance_referent has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def enhance_referent(key, value, metadata=true, private_data=false, options = {})
              
              
                  ActiveRecord::Base.connection_pool.with_connection do
                    return if value.nil?
              Severity: Minor
              Found in app/models/referent.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_by_title has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  def find_by_title
                    connection = sfx4_db_connection
                    query_match_clause = case search_type_param
                      when "contains"
                        terms = title_query_param.split(" ")
              Severity: Minor
              Found in app/controllers/search_methods/sfx4.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 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 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)
                
                    bibkeys = get_bibkeys(request.referent)
                    return request.dispatched(self, true) if bibkeys.nil?
                
                
                Severity: Minor
                Found in app/service_adaptors/google_book_search.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
                  Severity
                  Category
                  Status
                  Source
                  Language