actionpack/lib/action_dispatch/middleware/debug_locks.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method render_details has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

      def render_details(req)
        threads = ActiveSupport::Dependencies.interlock.raw_state do |raw_threads|
          # The Interlock itself comes to a complete halt as long as this block is
          # executing. That gives us a more consistent picture of everything, but creates
          # a pretty strong Observer Effect.
Severity: Minor
Found in actionpack/lib/action_dispatch/middleware/debug_locks.rb - About 4 hrs 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 render_details has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def render_details(req)
        threads = ActiveSupport::Dependencies.interlock.raw_state do |raw_threads|
          # The Interlock itself comes to a complete halt as long as this block is
          # executing. That gives us a more consistent picture of everything, but creates
          # a pretty strong Observer Effect.
Severity: Minor
Found in actionpack/lib/action_dispatch/middleware/debug_locks.rb - About 1 hr to fix

    Method blocked_by? has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def blocked_by?(victim, blocker, all_threads)
            return false if victim.equal?(blocker)
    
            case victim[:sleeper]
            when :start_sharing
    Severity: Minor
    Found in actionpack/lib/action_dispatch/middleware/debug_locks.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