team-umlaut/umlaut

View on GitHub

Showing 202 of 234 total issues

Method parse_perl_data has a Cognitive Complexity of 30 (exceeds 5 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 4 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 a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

  def handle(request)
    scopus_query = scopus_query(request)

    # we can't make a good query, nevermind. 
    return request.dispatched(self, true) if scopus_query.blank? 
Severity: Minor
Found in app/service_adaptors/scopus2.rb - About 4 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

File internet_archive.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class InternetArchive < Service
  require 'open-uri' #
  require 'cgi'
  require 'multi_json' #we ask IA for json
  require 'timeout' # used to timeout our requests
Severity: Minor
Found in app/service_adaptors/internet_archive.rb - About 4 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if options[:coverage_sensitive] == true
          # roll up targets with same prefix only if coverage is a strict
          # subset of an existing one. If two are equal, take first.
          list = list.reject.each_with_index do |item, index|
            prefix = prefixes.find {|p| item[:sfx_target_name].start_with?(p)}
    Severity: Critical
    Found in app/service_adaptors/sfx.rb - About 4 hrs to fix

      Method gen_lamr_request has a Cognitive Complexity of 27 (exceeds 5 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 3 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 included has a Cognitive Complexity of 27 (exceeds 5 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 3 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 add_copies has a Cognitive Complexity of 26 (exceeds 5 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 3 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

      Function HtmlUpdater has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function HtmlUpdater(first_arg, second_arg, third_arg) {
          if (typeof(first_arg) == "object") {
            // Simply merge arguments object as properties on ourselves. 
           $.extend(this, first_arg);
          } else {
      Severity: Major
      Found in app/assets/javascripts/umlaut/update_html.js - About 3 hrs to fix

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

          def handle(request)
            
            # Only do anything if we have no holdings results from someone else.
            holdings = request.service_types.where(:service_type_value_name => "holding")
            
        Severity: Major
        Found in app/service_adaptors/hip_holding_search.rb - About 3 hrs to fix

          File bootstrap3-typeahead.js has 307 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* =============================================================
           * bootstrap3-typeahead.js v3.0.3
           * https://github.com/bassjobsen/Bootstrap-3-Typeahead
           * =============================================================
           * Original written by @mdo and @fat
          Severity: Minor
          Found in app/assets/javascripts/bootstrap3-typeahead.js - About 3 hrs to fix

            Method add_aws_service_responses has 84 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def add_aws_service_responses(request, aws_response)
                return_hash = Hash.new
                    
                aws = Nokogiri::XML(aws_response.body)
                # extract and collect info from the xml    
            Severity: Major
            Found in app/service_adaptors/amazon.rb - About 3 hrs to fix

              Class WorldcatIdentities has 28 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class WorldcatIdentities < Service
                require 'open-uri' # SRU is too slow even though we use an SRU-like link
                require 'nokogiri'
                include MetadataHelper
                
              Severity: Minor
              Found in app/service_adaptors/worldcat_identities.rb - About 3 hrs to fix

                Method handle has a Cognitive Complexity of 23 (exceeds 5 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 3 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 should_skip_menu has a Cognitive Complexity of 22 (exceeds 5 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 3 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 do_query has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                  def do_query(request)
                    # get the search terms for use in both fulltext search and highlighted_link
                    # IA does index apostrophes, although not generally other puncutation. Need to keep em.
                    search_terms = {:title => get_search_title(request.referent ,:keep_apostrophes=>true),
                    :creator => get_search_creator(request.referent)}
                Severity: Minor
                Found in app/service_adaptors/internet_archive.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 brief_citation has a Cognitive Complexity of 21 (exceeds 5 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 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 normalize_title has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                  def normalize_title(arg_title, options = {})
                    # default options
                    options[:rstrip_parens] ||= true
                    options[:remove_all_parens] ||= true
                    options[:strip_gmd] ||= true
                Severity: Minor
                Found in app/mixin_logic/metadata_helper.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 http_fetch has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                  def http_fetch(uri, options = {})
                    options[:max_redirects] ||= 8
                    options[:redirects_left] ||= options[:max_redirects]
                    options[:raise_on_http_error_code] = true unless options.has_key?(:raise_on_http_error_code)
                
                
                Severity: Minor
                Found in app/mixin_logic/umlaut_http.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

                File opac.rb has 279 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class Opac < Service
                  attr_reader :record_attributes, :display_name
                
                  # The Opac class has a few assumptions
                  # * You have some sort of bib client to get MARC records from your OPAC
                Severity: Minor
                Found in app/service_adaptors/opac.rb - About 2 hrs to fix

                  Method find_by_title has 67 lines of code (exceeds 25 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: Major
                  Found in app/controllers/search_methods/sfx4.rb - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language