File test_case.rb
has 380 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rack/session/abstract/id"
require "active_support/core_ext/hash/conversions"
require "active_support/core_ext/object/to_query"
require "active_support/core_ext/module/anonymous"
require "active_support/core_ext/module/redefine_method"
Class TestCase
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class TestCase < ActiveSupport::TestCase
singleton_class.attr_accessor :executor_around_each_request
module Behavior
extend ActiveSupport::Concern
Method assign_parameters
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def assign_parameters(routes, controller_path, action, parameters, generated_path, query_string_keys)
non_path_parameters = {}
path_parameters = {}
parameters.each do |key, value|
- 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 assign_parameters
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def assign_parameters(routes, controller_path, action, parameters, generated_path, query_string_keys)
non_path_parameters = {}
path_parameters = {}
parameters.each do |key, value|
Method setup_controller_request_and_response
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def setup_controller_request_and_response
@controller = nil unless defined? @controller
@response_klass = ActionDispatch::TestResponse
- 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 process
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process(action, method: "GET", params: nil, session: nil, body: nil, flash: {}, format: nil, xhr: false, as: nil)
check_required_ivars
@controller.clear_instance_variables_between_requests
action = +action.to_s
Method process_controller_response
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def process_controller_response(action, cookies, xhr)
begin
@controller.recycle!
wrap_execution { @controller.dispatch(action, @request, @response) }
Method assign_parameters
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def assign_parameters(routes, controller_path, action, parameters, generated_path, query_string_keys)
Method setup_request
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def setup_request(controller_class_name, action, parameters, session, flash, xhr)
Method process_controller_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_controller_response(action, cookies, xhr)
begin
@controller.recycle!
wrap_execution { @controller.dispatch(action, @request, @response) }
- 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"