actionpack/lib/action_dispatch/http/response.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Response has 46 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Response
    begin
      # For `Rack::Headers` (Rack 3+):
      require "rack/headers"
      Headers = ::Rack::Headers
Severity: Minor
Found in actionpack/lib/action_dispatch/http/response.rb - About 6 hrs to fix

    File response.rb has 350 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "active_support/core_ext/module/attribute_accessors"
    require "action_dispatch/http/filter_redirect"
    require "action_dispatch/http/cache"
    require "monitor"
    
    
    Severity: Minor
    Found in actionpack/lib/action_dispatch/http/response.rb - About 4 hrs to fix

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

          def cookies
            cookies = {}
            if header = get_header(SET_COOKIE)
              header = header.split("\n") if header.respond_to?(:to_str)
              header.each do |cookie|
      Severity: Minor
      Found in actionpack/lib/action_dispatch/http/response.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 content_type= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def content_type=(content_type)
            return unless content_type
            new_header_info = parse_content_type(content_type.to_s)
            prev_header_info = parsed_content_type_header
            charset = new_header_info.charset || prev_header_info.charset
      Severity: Minor
      Found in actionpack/lib/action_dispatch/http/response.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

      There are no issues that match your filters.

      Category
      Status