ciberch/mirror-api

View on GitHub

Showing 7 of 7 total issues

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

    class Request
      TIMELINE = "timeline"
      SUBSCRIPTIONS = "subscriptions"
      LOCATIONS = "locations"
      CONTACTS = "contacts"
Severity: Minor
Found in lib/mirror-api/request.rb - About 2 hrs to fix

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

          def invoke_url
            return @invoke_url unless @invoke_url.nil?
            @invoke_url ="#{self.host}/mirror/v1/#{@resource}/#{@id ? @id : ''}"
            @invoke_url += "/attachments/#{attachment_id ? attachment_id : ''}" if attachments
            @invoke_url
    Severity: Minor
    Found in lib/mirror-api/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 handle_error has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def handle_error(error_desc, msg, errors, validation_error=nil, params={})
    Severity: Minor
    Found in lib/mirror-api/request.rb - About 35 mins to fix

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

            def params=(value)
              if value
                if value.is_a?(RequestData)
                  @params = value
                elsif value.is_a?(Hash) && value.keys.count > 0
      Severity: Minor
      Found in lib/mirror-api/request.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

      Method handle_http_response has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def handle_http_response(response, request, result, &block)
              @request = request
              case response.code
                when 404, 400
                  @error_response = response.body
      Severity: Minor
      Found in lib/mirror-api/request.rb - About 25 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 resource= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def resource=(value)
              if value
                if VALID_RESOURCES.include?(value)
                  @resource = value
                else
      Severity: Minor
      Found in lib/mirror-api/request.rb - About 25 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_error has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def handle_error(error_desc, msg, errors, validation_error=nil, params={})
              @last_error = error_desc.dup
              @last_error[:errors] = errors
              @last_error[:validation_error] = validation_error if validation_error
              msg += " with params #{params}"
      Severity: Minor
      Found in lib/mirror-api/request.rb - About 25 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