Showing 447 of 447 total issues
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(mongocrypt, io, master_key_document, key_alt_names, key_material)
Method valid_available_connection?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def valid_available_connection?(connection, pid, connection_global_id)
if connection.pid != pid
log_warn("Detected PID change - Mongo client should have been reconnected (old pid #{connection.pid}, new pid #{pid}")
connection.disconnect!(reason: :stale)
@populate_semaphore.signal
- 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 converse_multi_step
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def converse_multi_step(connection, conversation,
speculative_auth_result: nil
)
# Although the SASL conversation in theory can have any number of
# steps, all defined authentication methods have a predefined number
- 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 read_scheduled_kill_specs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def read_scheduled_kill_specs
while kill_spec = @kill_spec_queue.pop(true)
if @active_cursor_ids.include?(kill_spec.cursor_id)
@to_kill[kill_spec.server_address] ||= Set.new
@to_kill[kill_spec.server_address] << kill_spec
- 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 standard_dependencies
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def standard_dependencies
gem 'yard', '>= 0.9.35'
gem 'ffi'
group :development, :testing do
- 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 command_completed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def command_completed(result, address, operation_id, payload, duration,
started_event:, server_connection_id: nil, service_id: nil
)
document = result ? (result.documents || []).first : nil
if document && (document['ok'] && document['ok'] != 1 || document.key?('$err'))
- 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 summary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. 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"
Further reading
Method remove
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def remove(host, disconnect: true)
address = Address.new(host)
removed_servers = []
@update_lock.synchronize do
@servers.delete_if do |server|
- 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 summary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def summary
fileno = @socket&.fileno rescue '<no socket>' || '<no socket>'
if monitor?
indicator = if options[:push]
'pm'
- 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 generate_reply
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.generate_reply(command_payload, reply_payload)
if reply_payload
reply = reply_payload[:reply]
if cursor = reply[:cursor]
if !cursor.key?(Collection::NS)
- 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 serialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def serialize(message, context, buffer = BSON::ByteBuffer.new)
# Driver specifications only mandate the fixed 16MiB limit for
# serialized BSON documents. However, the server returns its
# active serialized BSON document size limit in the hello response,
# which is +max_bson_object_size+ below. The +DEFAULT_MAX_BSON_OBJECT_SIZE+
- 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 disconnect!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def disconnect!(options = nil)
# Note: @closed may be true here but we also may have a socket.
# Check the socket and not @closed flag.
@auth_mechanism = nil
@last_checkin = nil
- 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"
Further reading
Method initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(doc)
if Lint.enabled?
unless doc['processId']
raise ArgumentError, 'Creating a topology version without processId field'
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 validate_read_preference!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate_read_preference!(command)
return unless in_transaction?
return unless command['$readPreference']
mode = command['$readPreference']['mode'] || command['$readPreference'][:mode]
- 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 convert_ms
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def convert_ms(name, value)
case value
when String
if /\A-?\d+(\.\d+)?\z/ !~ value
log_warn("Invalid ms value for #{name}: #{value}")
- 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 update_rs_with_primary_from_member
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_rs_with_primary_from_member
if topology.replica_set_name != updated_desc.replica_set_name
log_warn(
"Removing server #{updated_desc.address.to_s} because it has an " +
"incorrect replica set name (#{updated_desc.replica_set_name}); " +
- 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 remove_servers_not_in_desc
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def remove_servers_not_in_desc(updated_desc)
updated_desc_address_strs = %w(hosts passives arbiters).map do |m|
updated_desc.send(m)
end.flatten
servers_list.each do |server|
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def try_next
raise StopIteration.new if closed?
begin
doc = @cursor.try_next
rescue Mongo::Error => 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(server_session, client, options = {})
if options[:causal_consistency] && options[:snapshot]
raise ArgumentError, ':causal_consistency and :snapshot options cannot be both set on a session'
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"