team-umlaut/umlaut

View on GitHub

Showing 236 of 236 total issues

Method journal_search has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def journal_search
    @batch_size = batch_size
    @start_result_num = (page * batch_size) - (batch_size - 1)
    @search_context_object = context_object_from_params
    if (! params["rft.object_id"].blank? ||
Severity: Minor
Found in app/controllers/search_controller.rb - About 1 hr to fix

    Method sfx4_db_to_ctxobj has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def sfx4_db_to_ctxobj(title_rows)
          title_rows.collect do |sfx_obj|
            ctx = OpenURL::ContextObject.new
            # Start out wtih everything in search, to preserve date/vol/etc
            ctx.import_context_object( context_object_from_params )        
    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 list_with_limit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def list_with_limit(id, list, options = {}, &block)
        # backwards compatible to when third argument was just a number
        # for limit.
        options = {:limit => options} unless options.kind_of?(Hash)
        options[:limit] ||= 5
    Severity: Minor
    Found in app/helpers/resolve_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 filter has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

      def filter(referent)
        issn = get_identifier(:urn, "issn", referent)
        return unless issn
    
        # normalize removing hyphen
    Severity: Minor
    Found in app/referent_filters/dissertation_catch.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 create_by_context_object has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.create_by_context_object(co, options = {})    
        self.clean_up_context_object(co)    
        
        rft = Referent.new
    
    
    Severity: Minor
    Found in app/models/referent.rb - About 1 hr to fix

      Method should_skip_menu has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def should_skip_menu
          # From usabilty test, do NOT skip if coming from A-Z list/journal lookup.
          # First, is it over-ridden in url?
          if ( params['umlaut.skip_resolve_menu'] == 'false')
            return nil
      Severity: Minor
      Found in app/controllers/resolve_controller.rb - About 1 hr to fix

        Method enhance_referent has 27 lines of code (exceeds 25 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

          Method brief_citation has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def brief_citation(request, options = {})
              options[:include_labels] ||= false
              rv =""
              cite = request.referent.to_citation
              title = truncate(cite[:title].strip, :length => 70,  :separator => ' ')
          Severity: Minor
          Found in app/helpers/emailer_helper.rb - About 1 hr to fix

            Method list_with_limit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def list_with_limit(id, list, options = {}, &block)
                # backwards compatible to when third argument was just a number
                # for limit.
                options = {:limit => options} unless options.kind_of?(Hash)
                options[:limit] ||= 5
            Severity: Minor
            Found in app/helpers/resolve_helper.rb - About 1 hr to fix

              Method find_by_group has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def find_by_group
                    connection = sfx4_db_connection
                    from_where_clause = %{
                         FROM 
                            AZ_TITLE T 
              Severity: Minor
              Found in app/controllers/search_methods/sfx4.rb - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                      if (other_type == "*")
                        # Need to check dispatched services instead of service_types,
                        # as we pre-empt even if no services created. 
                        preemption = 
                        uml_request.dispatched_services.to_a.find do |disp|
                Severity: Major
                Found in app/service_adaptors/service.rb - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                      if ( oclcnum.blank? && ( metadata['aulast'].blank? || metadata['aufirst'].blank? ) && metadata['au'].blank? && metadata['aucorp'].blank?  ) or (oclcnum.blank? && @require_identifier) 
                        Rails.logger.debug("Worldcat Identities Service Adaptor: Skipped: Insufficient metadata for lookup")      
                        return nil
                      end
                  Severity: Major
                  Found in app/service_adaptors/worldcat_identities.rb - About 1 hr to fix

                    Method title has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def title
                          unless (@title)
                            # title may already have been lazily loaded, or loaded by the
                            # bibsearcher. Otherwise, we need to extract it from the bib_xml, 
                            # which is kind of a pain.
                    Severity: Minor
                    Found in app/models/hip3/bib.rb - About 55 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 search has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def search
                          return [] if insufficient_query
                                httpResp = httpSession.get(searchPath(), nil )
                    
                          
                    Severity: Minor
                    Found in app/models/hip3/bib_searcher.rb - About 55 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 edition_str has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def edition_str(result)
                        edition_str = ""
                        
                        edition_str << result['title'] unless result['title'].blank?
                    
                    
                    Severity: Minor
                    Found in app/service_adaptors/internet_archive.rb - About 55 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 index has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def index
                        perm = Permalink.where(:id => params[:id]).first
                        handle_404_error and return unless perm # not in our db
                    
                        co = OpenURL::ContextObject.new
                    Severity: Minor
                    Found in app/controllers/store_controller.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def handle(request)
                        image_url = image_url(request.referent)
                        return request.dispatched(self, true) unless image_url
                    
                        uri = URI.parse(image_url)
                    Severity: Minor
                    Found in app/service_adaptors/cover_thing.rb - About 55 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 parse_field has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.parse_field(str, first, last)
                          list = str.split(",")
                          list.map!{|r|
                            r, every = r.split("/")
                            every = every ? every.to_i : 1
                    Severity: Minor
                    Found in lib/cron_tab.rb - About 55 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_sudoc has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def get_sudoc(rft)
                        # Don't forget to unescape the sudoc that was escaped to maek it a uri!
                        
                        # Option 1: In a technically illegal but oh well info:sudoc uri
                        
                    Severity: Minor
                    Found in app/mixin_logic/metadata_helper.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 context_object_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def self.context_object_params(a_rails_request)   
                        
                        # GET params
                        co_params = CGI::parse( a_rails_request.query_string )    
                        # add in the POST params please
                    Severity: Minor
                    Found in app/models/request.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

                    Severity
                    Category
                    Status
                    Source
                    Language