lib/mongo/server.rb
Class Server
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Server
extend Forwardable
include Monitoring::Publishable
include Event::Publisher
File server.rb
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module Mongo
# Represents a single server on the server side that can be standalone, part of
# a replica set, or a mongos.
#
Method initialize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(address, cluster, monitoring, event_listeners, options = {})
@address = address
@cluster = cluster
@monitoring = monitoring
options = options.dup
Method unknown!
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def unknown!(options = {})
pool = pool_internal
if load_balancer?
# When the client is in load-balanced topology, servers (the one and
Method unknown!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def unknown!(options = {})
pool = pool_internal
if load_balancer?
# When the client is in load-balanced topology, servers (the one and
- 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(address, cluster, monitoring, event_listeners, options = {})
Method summary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def summary
status = self.status || ''
if replica_set_name
status += " replica_set=#{replica_set_name}"
end
- 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"