actionpack/lib/action_dispatch/http/request.rb
Class Request
has 57 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Request
include Rack::Request::Helpers
include ActionDispatch::Http::Cache::Request
include ActionDispatch::Http::MimeNegotiation
include ActionDispatch::Http::Parameters
File request.rb
has 303 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require "stringio"
require "active_support/inflector"
require "action_dispatch/http/headers"
require "action_controller/metal/exceptions"
Method controller_class_for
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def controller_class_for(name)
if name
controller_param = name.underscore
const_name = controller_param.camelize << "Controller"
begin
- 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"