neglectedvalue/yup

View on GitHub
lib/yup/request_forwarder.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method perform has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def perform
      http_method = @http_method.to_sym
      http_url    = "http://#{@forward_to}#{@request_url}"
      http = EventMachine::HttpRequest.
        new(http_url,
Severity: Minor
Found in lib/yup/request_forwarder.rb - About 1 hr to fix

    Method log_response has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def log_response(http)
          @logger.info { "HTTP request: #{@http_method.upcase} #{@request_url} HTTP/1.1" }
          if http.response_header.http_status
            @logger.info  { "HTTP response: HTTP/#{http.response_header.http_version} #{http.response_header.http_status} #{http.response_header.http_reason}" }
            @logger.debug { "HTTP response headers" + (http.response_header.empty? ? " is empty" : "\n" + http.response_header.inspect) }
    Severity: Minor
    Found in lib/yup/request_forwarder.rb - About 55 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 initialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(http_method, request_url, headers, body, forward_to, timeout)
    Severity: Minor
    Found in lib/yup/request_forwarder.rb - About 45 mins to fix

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

          def perform
            http_method = @http_method.to_sym
            http_url    = "http://#{@forward_to}#{@request_url}"
            http = EventMachine::HttpRequest.
              new(http_url,
      Severity: Minor
      Found in lib/yup/request_forwarder.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

      There are no issues that match your filters.

      Category
      Status