Showing 423 of 480 total issues
Method do_check_in
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def do_check_in(connection)
# When a connection is interrupted it is checked back into the pool
# and closed. The operation that was using the connection before it was
# interrupted will attempt to check it back into the pool, and we
# should ignore it since its already been closed and removed from the pool.
- 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 start_stop_srv_monitor
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def start_stop_srv_monitor
# SRV URI is either always given or not for a given cluster, if one
# wasn't given we shouldn't ever have an SRV monitor to manage.
return unless options[:srv_uri]
- 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 connect!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def connect!(context = nil)
raise_if_closed!
unless @socket
@socket = create_socket(context)
- 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 a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(server, options = {})
unless server.is_a?(Server)
raise ArgumentError, 'First argument must be a Server instance'
end
options = options.dup
- 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 close
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def close
@state_change_lock.synchronize do
unless connecting? || connected?
return nil
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"
Further reading
Method write_chunk
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def write_chunk(chunk, timeout)
deadline = Utils.monotonic_time + timeout
written = 0
begin
written += @socket.write_nonblock(chunk[written..-1])
- 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 try_select_server
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def try_select_server(cluster, write_aggregation: false, deprioritized: [])
servers = if write_aggregation && cluster.replica_set?
# 1. Check if ALL servers in cluster support secondary writes.
is_write_supported = cluster.servers.reduce(true) do |res, server|
res && server.features.merge_out_on_secondary_enabled?
- 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 try_next
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def try_next
if @documents.nil?
# Since published versions of Mongoid have a copy of old driver cursor
# code, our dup call in #process isn't invoked when Mongoid query
# cache is active. Work around that by also calling dup here on
- 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 smc_to_ruby
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def smc_to_ruby(opts)
uri_options = {}
opts.each do |key, value|
strategy = URI_OPTION_MAP[key.downcase]
- 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 validate_length!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_length!(index, num_chunks, chunk, length_read)
if num_chunks > 0 && chunk.data.data.size > 0
raise Error::ExtraFileChunk.new unless index < num_chunks
if index == num_chunks - 1
unless chunk.data.data.size + length_read == file_info.length
- 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 deserialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.deserialize(io,
max_message_size = MAX_MESSAGE_SIZE,
expected_response_to = nil,
options = {}
)
- 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 build_message
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def build_message
errors = @result['writeErrors']
return nil unless errors
fragment = ""
- 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 delete_many
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def delete_many(opts = {})
with_session(opts) do |session|
write_concern = if opts[:write_concern]
WriteConcern.get(opts[:write_concern])
else
Method do_check_in
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_check_in(connection)
# When a connection is interrupted it is checked back into the pool
# and closed. The operation that was using the connection before it was
# interrupted will attempt to check it back into the pool, and we
# should ignore it since its already been closed and removed from the pool.
Method server_version_gte?
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def server_version_gte?(version)
required_wv = case version
when '7.0'
21
when '6.0'
Method count
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def count(opts = {})
opts = @options.merge(opts) unless Mongo.broken_view_options
cmd = { :count => collection.name, :query => filter }
cmd[:skip] = opts[:skip] if opts[:skip]
cmd[:hint] = opts[:hint] if opts[:hint]
Method run_sdam_flow
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_sdam_flow(previous_desc, updated_desc, options = {})
if load_balanced?
if updated_desc.config.empty?
unless options[:keep_connection_pool]
servers_list.each do |server|
Method initialize
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(opts)
@opts = opts
return if empty?
if opts[:access_token]
Method publish_heartbeat
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def publish_heartbeat(server, awaited: false)
if monitoring?
started_event = Event::ServerHeartbeatStarted.new(
server.address, awaited: awaited)
started(SERVER_HEARTBEAT, started_event)
Method deserialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.deserialize(io,
max_message_size = MAX_MESSAGE_SIZE,
expected_response_to = nil,
options = {}
)