Method add_server_diagnostics
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_server_diagnostics
yield
# Note that the exception should already have been mapped to a
# Mongo::Error subclass when it gets to this method.
rescue Error::SocketError, Error::SocketTimeoutError => e
- 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 set_compressor!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_compressor!(reply)
server_compressors = reply['compression']
if options[:compressors]
if intersection = (server_compressors & options[:compressors])
- 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 handshake_document
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handshake_document(app_metadata, speculative_auth_doc: nil, load_balancer: false, server_api: nil)
serv_api = app_metadata.server_api || server_api
document = if serv_api
HELLO_DOC.merge(Utils.transform_server_api(serv_api))
else
- 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"