josephholsten/rets4r

View on GitHub
lib/rets4r/client.rb

Summary

Maintainability
D
1 day
Test Coverage

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 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 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

            There are no issues that match your filters.

            Category
            Status