Showing 423 of 480 total issues
Method selector
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def selector(connection)
{
createIndexes: coll_name,
indexes: indexes,
comment: spec[:comment],
- 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 distinct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def distinct(field_name, opts = {})
if field_name.nil?
raise ArgumentError, 'Field name for distinct operation must be not nil'
end
opts = @options.merge(opts) unless Mongo.broken_view_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 server_selection_diagnostic_message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def server_selection_diagnostic_message(cluster)
msg = ''
dead_monitors = []
cluster.servers_list.each do |server|
thread = server.monitor.instance_variable_get('@thread')
- 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 n_matched
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def n_matched
return 0 unless acknowledged?
@replies.reduce(0) do |n, reply|
if upsert?(reply)
reply.documents.first[N] - n_upserted
- 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 operation_timeouts
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def operation_timeouts(opts)
{
inherited_timeout_ms: @client.timeout_ms
}.tap do |result|
if @with_transaction_deadline.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 parse!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse!(remaining)
super
if @servers.length != 1
raise_invalid_error!(INVALID_HOST)
- 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 each
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def each
@cursor = prefer_cached_cursor? ? cached_cursor : new_cursor_for_iteration
return @cursor.to_enum unless block_given?
limit_for_cached_query = compute_limit_for_cached_query
- 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 select_cursor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def select_cursor(session)
context = Operation::Context.new(
client: client,
session: session,
operation_timeouts: operation_timeouts,
- 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_server_descriptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_server_descriptions
servers_list.each do |server|
if server.address == updated_desc.address
# SDAM flow must be run when topology version in the new description
# is equal to the current topology version, per the example in
- 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 do_drop
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def do_drop(operation, session, context)
operation.execute(next_primary(nil, session), context: context)
rescue Error::OperationFailure::Family => ex
# NamespaceNotFound
if ex.code == 26 || ex.code.nil? && ex.message =~ /ns not found/
- 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 apply_relevant_timeouts_to
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def apply_relevant_timeouts_to(spec, connection)
with_max_time(connection) do |max_time_sec|
timeout_ms = max_time_sec ? (max_time_sec * 1_000).to_i : nil
apply_find_timeouts_to(spec, timeout_ms) unless connection.description.mongocryptd?
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 check_transactions_supported!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_transactions_supported!
raise Mongo::Error::TransactionsNotSupported, "standalone topology" if cluster.single?
cluster.next_primary.with_connection do |conn|
if cluster.replica_set? && !conn.features.transactions_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 process_result_for_sdam
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_result_for_sdam(result, connection)
if (result.not_master? || result.node_recovering?) &&
connection.generation >= connection.server.pool.generation(service_id: connection.service_id)
then
if result.node_shutting_down?
- 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 verify_invariants
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify_invariants
if Mongo::Lint.enabled?
if cluster.topology.single?
if cluster.servers_list.length > 1
raise Mongo::Error::LintError, "Trying to create a single topology with multiple servers: #{cluster.servers_list}"
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def close(opts = {})
return if closed?
ctx = context ? context.refresh(timeout_ms: opts[:timeout_ms]) : fresh_context(opts)
- 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 n_modified
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def n_modified
return 0 unless acknowledged?
@replies.reduce(0) do |n, reply|
if n && reply.documents.first[MODIFIED]
n += reply.documents.first[MODIFIED]
- 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 parse_user!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_user!(string)
if (string && user = string.partition(AUTH_USER_PWD_DELIM)[0])
raise_invalid_error!(UNESCAPED_USER_PWD) if user =~ UNSAFE
user_decoded = decode(user)
if user_decoded =~ PERCENT_CHAR && encode(user_decoded) != user
- 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 create_many
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_many(*models)
models = models.flatten
options = {}
if models && !models.last.key?(:key)
options = models.pop
- 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 parse_txt_options!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_txt_options!(string)
string.split(INDIV_URI_OPTS_DELIM).reduce({}) do |txt_options, opt|
raise Error::InvalidTXTRecord.new(INVALID_OPTS_VALUE_DELIM) unless opt.index(URI_OPTS_VALUE_DELIM)
key, value = opt.split('=')
unless VALID_TXT_OPTIONS.include?(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 each
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def each
raise StopIteration.new if closed?
loop do
document = try_next
yield document if document
- 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"