mongodb/mongo-ruby-driver

View on GitHub
lib/mongo/server/push_monitor.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method check has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def check
        @lock.synchronize do
          if @connection && @connection.pid != Process.pid
            log_warn("Detected PID change - Mongo client should have been reconnected (old pid #{@connection.pid}, new pid #{Process.pid}")
            @connection.disconnect!
Severity: Minor
Found in lib/mongo/server/push_monitor.rb - About 1 hr to fix

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

          def check
            @lock.synchronize do
              if @connection && @connection.pid != Process.pid
                log_warn("Detected PID change - Mongo client should have been reconnected (old pid #{@connection.pid}, new pid #{Process.pid}")
                @connection.disconnect!
    Severity: Minor
    Found in lib/mongo/server/push_monitor.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 stop! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def stop!
            @lock.synchronize do
              @stop_requested = true
              if @connection
                # Interrupt any in-progress exhausted hello reads by
    Severity: Minor
    Found in lib/mongo/server/push_monitor.rb - About 45 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 do_work has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def do_work
            @lock.synchronize do
              return if @stop_requested
            end
    
    
    Severity: Minor
    Found in lib/mongo/server/push_monitor.rb - About 45 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