team-umlaut/umlaut

View on GitHub

Showing 202 of 234 total issues

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

                def self.clean_up_context_object(co)
                  # First, remove any empty DOIs! or other empty identifiers?
                  # LOTS of sources send awful empty identifiers. 
                  # That's not a valid identifier!
                  empty_ids = co.referent.identifiers.find_all { |i| i =~ Regexp.new('^[^:]+:[^/:]*(/|:)?$')}
              Severity: Minor
              Found in app/models/referent.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 expand_contract_section has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def expand_contract_section(arg_heading, id, options={}, &block)
                  expanded = (params["umlaut.show_#{id}"] == "true") || options[:initial_expand] || false
                  icon = content_tag(:i, nil, :class => [] << ( expanded ? "umlaut_icons-list-open" : "umlaut_icons-list-closed"))
                  heading = content_tag(:span,( expanded ? "Hide " : "Show "), :class=>'expand_contract_action_label') + arg_heading
                  body_class = (expanded ? "in" : "")
              Severity: Minor
              Found in app/helpers/resolve_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

              Method sfx_controls_url? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.sfx_controls_url?(url)
                  ActiveRecord::Base.connection_pool.with_connection do
                    # Does it match any of our supplementary configged strings or regexps?
                    UmlautController.umlaut_config.lookup!("sfx.additional_sfx_controlled_urls", []).each do |test|
                      # '===' will match a regexp or equality on a string
              Severity: Minor
              Found in app/models/sfx_url.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 service_type_for_856 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def service_type_for_856(field, options)
                  options[:default_service_type] ||= "fulltext_title_level"
              
                  # LC records here at hopkins have "Table of contents only" in the 856$3
                  # Think that's a convention from LC?
              Severity: Minor
              Found in app/mixin_logic/marc_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 get_years has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def get_years(marc)
                  array = []
              
                  # no marc 008? Weird, but okay.
                  return array unless marc['008']
              Severity: Minor
              Found in app/mixin_logic/marc_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 to_context_object has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def to_context_object(context_object)
                      ctx = OpenURL::ContextObject.new
                      # Start out wtih everything in search, to preserve date/vol/etc
                      ctx.import_context_object(context_object)
                      # Put SFX object id in rft.object_id, that's what SFX does.
              Severity: Minor
              Found in app/models/sfx4/abstract/az_title.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 build_headers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def build_headers(request)
                  original_forwarded_for = nil
                  if (request.http_env && request.http_env['HTTP_X_FORWARDED_FOR'])
                    original_forwarded_for = request.http_env['HTTP_X_FORWARDED_FOR']                                  
                  end
              Severity: Minor
              Found in app/service_adaptors/google_book_search.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