Method write_cached_response
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def write_cached_response(request, response, result, quiet)
return if result.is_a? Symbol
return unless perform_caching
return unless !result.respond_to?(:_status) || [200, 304].include?(result._status)
headers = response.response_headers
- 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 perform_caching
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def perform_caching(value = nil)
@perform_caching = nil unless instance_variable_defined?(:@perform_caching)
if value.nil?
value = if @perform_caching.nil?
@@perform_caching
- 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 cache_store=
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cache_store=(value)
@@cache_store = nil if value.nil? and return
raise InvalidCacheStoreException.new("Cache store does not implement #read") unless value.respond_to?(:read)
raise InvalidCacheStoreException.new("Cache store does not implement #write") unless value.respond_to?(:write)
raise InvalidCacheStoreException.new("Cache store does not implement #fetch") unless value.respond_to?(:fetch)
- 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 read_cached_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def read_cached_response(request, quiet)
if cache_store && perform_caching && request.method[:method] == :get
key = "#{request.class_name}:#{request.original_url}"
Flexirest::Logger.debug " \033[1;4;32m#{Flexirest.name}\033[0m #{key} - Trying to read from cache" unless quiet
value = cache_store.read(key)
- 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"