lib/mini_profiler/actions.rb
Method serve_snapshot
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def serve_snapshot(env)
MiniProfiler.authorize_request
status = 200
headers = { 'Content-Type' => 'text/html' }
qp = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
Method serve_results
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def serve_results(env)
request = Rack::Request.new(env)
id = request.params['id']
group_name = request.params['group']
is_snapshot = group_name && group_name.size > 0
Method serve_results
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def serve_results(env)
request = Rack::Request.new(env)
id = request.params['id']
group_name = request.params['group']
is_snapshot = group_name && group_name.size > 0
- 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 serve_profile_memory
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def serve_profile_memory(env, client_settings)
return tool_disabled_message(client_settings) if !advanced_debugging_enabled?
unless defined?(MemoryProfiler) && MemoryProfiler.respond_to?(:report)
message = "Please install the memory_profiler gem and require it: add gem 'memory_profiler' to your Gemfile"
- 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"