josephholsten/rets4r

View on GitHub

Showing 15 of 15 total issues

Method request has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

      def request(url, data = {}, header = {}, method = @method, retry_auth = DEFAULT_RETRY)
        response = ''

        http = Net::HTTP.new(url.host, url.port)
        http.read_timeout = 600
Severity: Minor
Found in lib/rets4r/client/requester.rb - About 5 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 get_object has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    def get_object(resource, type, id, location = false) #:yields: data_object
      header = {
        'Accept' => mimemap.keys.join(',')
      }

Severity: Minor
Found in lib/rets4r/client.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

Class Client has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Client
    COMPACT_FORMAT = 'COMPACT'

    METHOD_GET  = 'GET'
    METHOD_POST = 'POST'
Severity: Minor
Found in lib/rets4r/client.rb - About 2 hrs to fix

    File client.rb has 261 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'cgi'
    require 'digest/md5'
    require 'logger'
    require 'net/http'
    require 'uri'
    Severity: Minor
    Found in lib/rets4r/client.rb - About 2 hrs to fix

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

          def get_object(resource, type, id, location = false) #:yields: data_object
            header = {
              'Accept' => mimemap.keys.join(',')
            }
      
      
      Severity: Major
      Found in lib/rets4r/client.rb - About 2 hrs to fix

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

              def request(url, data = {}, header = {}, method = @method, retry_auth = DEFAULT_RETRY)
                response = ''
        
                http = Net::HTTP.new(url.host, url.port)
                http.read_timeout = 600
        Severity: Minor
        Found in lib/rets4r/client/requester.rb - About 1 hr to fix

          Method login has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              def login(username, password) #:yields: login_results
                @request_struct.username = username
                @request_struct.password = password
          
                # We are required to set the Accept header to this by the RETS 1.5 specification.
          Severity: Minor
          Found in lib/rets4r/client.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 login has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def login(username, password) #:yields: login_results
                @request_struct.username = username
                @request_struct.password = password
          
                # We are required to set the Accept header to this by the RETS 1.5 specification.
          Severity: Minor
          Found in lib/rets4r/client.rb - About 1 hr to fix

            Method calculate_digest has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def self.calculate_digest(username, password, realm, nonce, method, uri, qop = false, cnonce = false, nc = 0) # :nodoc:
            Severity: Major
            Found in lib/rets4r/auth.rb - About 1 hr to fix

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

                  def self.connection(spec = nil)
                    case spec
                      when nil
                        connection(RETS4R::ListingService.env)
                      when Symbol, String
              Severity: Minor
              Found in lib/rets4r/listing_service.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 authenticate has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def self.authenticate(response, username, password, uri, method, requestId, useragent, nc = 0) # :nodoc:
              Severity: Major
              Found in lib/rets4r/auth.rb - About 1 hr to fix

                Method request has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def request(url, data = {}, header = {}, method = @request_method, retry_auth = DEFAULT_RETRY)
                Severity: Minor
                Found in lib/rets4r/client.rb - About 35 mins to fix

                  Method request has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def request(url, data = {}, header = {}, method = @method, retry_auth = DEFAULT_RETRY)
                  Severity: Minor
                  Found in lib/rets4r/client/requester.rb - About 35 mins to fix

                    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                          def initialize(uri, type, id, format, request_struct)
                    Severity: Minor
                    Found in lib/rets4r/client/metadata_request.rb - About 35 mins to fix

                      Method start_element has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def start_element name, attrs = []
                                case name
                                when 'DELIMITER'
                                  # This is a workaround for the old attribute handling in nokogiri
                                  @delimiter = if Array === attrs.last
                      Severity: Minor
                      Found in lib/rets4r/client/parsers/compact_nokogiri.rb - About 35 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