WeAreFarmGeek/diplomat

View on GitHub
lib/diplomat/rest_client.rb

Summary

Maintainability
D
1 day
Test Coverage

Class RestClient has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

  class RestClient
    @access_methods = []
    @configuration = nil

    # Initialize the fadaray connection
Severity: Minor
Found in lib/diplomat/rest_client.rb - About 2 hrs to fix

    Method send_get_request has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def send_get_request(connection, url, options, custom_params = nil)
          rest_options = parse_options(options)
          url += rest_options[:query_params]
          url += custom_params unless custom_params.nil?
          begin
    Severity: Minor
    Found in lib/diplomat/rest_client.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 send_put_request has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def send_put_request(connection, url, options, data, custom_params = nil, mime = 'application/json')
          rest_options = parse_options(options)
          url += rest_options[:query_params]
          url += custom_params unless custom_params.nil?
          connection.put do |req|
    Severity: Minor
    Found in lib/diplomat/rest_client.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 return_value has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def return_value(nil_values = false, transformation = nil, return_hash = false)
          @value = decode_values
          return @value if @value.first.is_a? String
    
          if @value.count == 1 && !return_hash
    Severity: Minor
    Found in lib/diplomat/rest_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 send_post_request has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def send_post_request(connection, url, options, data, custom_params = nil)
          rest_options = parse_options(options)
          url += rest_options[:query_params]
          url += custom_params unless custom_params.nil?
          connection.post do |req|
    Severity: Minor
    Found in lib/diplomat/rest_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 send_delete_request has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def send_delete_request(connection, url, options, custom_params = nil)
          rest_options = parse_options(options)
          url += rest_options[:query_params]
          url += custom_params unless custom_params.nil?
          connection.delete do |req|
    Severity: Minor
    Found in lib/diplomat/rest_client.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 send_put_request has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def send_put_request(connection, url, options, data, custom_params = nil, mime = 'application/json')
    Severity: Minor
    Found in lib/diplomat/rest_client.rb - About 45 mins to fix

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

          def send_post_request(connection, url, options, data, custom_params = nil)
      Severity: Minor
      Found in lib/diplomat/rest_client.rb - About 35 mins to fix

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

            def parse_options(options)
              headers = nil
              query_params = []
              url_prefix = nil
              consistency = []
        Severity: Minor
        Found in lib/diplomat/rest_client.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

        There are no issues that match your filters.

        Category
        Status