MiniProfiler/rack-mini-profiler

View on GitHub
lib/mini_profiler/actions.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method serve_snapshot has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def serve_snapshot(env)
        MiniProfiler.authorize_request
        status = 200
        headers = { 'Content-Type' => 'text/html' }
        qp = Rack::Utils.parse_nested_query(env['QUERY_STRING'])
Severity: Minor
Found in lib/mini_profiler/actions.rb - About 1 hr to fix

    Method serve_results has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    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
    Severity: Minor
    Found in lib/mini_profiler/actions.rb - About 1 hr to fix

      Method serve_profile_memory has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      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"
      Severity: Minor
      Found in lib/mini_profiler/actions.rb - About 55 mins to fix

      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_results has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      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
      Severity: Minor
      Found in lib/mini_profiler/actions.rb - About 55 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status