actionpack/lib/action_dispatch/http/response.rb
Class Response
has 46 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Response
begin
# For `Rack::Headers` (Rack 3+):
require "rack/headers"
Headers = ::Rack::Headers
File response.rb
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require "active_support/core_ext/module/attribute_accessors"
require "action_dispatch/http/filter_redirect"
require "action_dispatch/http/cache"
require "monitor"
Method cookies
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def cookies
cookies = {}
if header = get_header(SET_COOKIE)
header = header.split("\n") if header.respond_to?(:to_str)
header.each do |cookie|
- Read upRead up
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
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
- Read upRead up
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"