Showing 393 of 447 total issues
Method initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(client: nil, session: nil, connection_global_id: nil, options: nil)
if options
if client
raise ArgumentError, 'Client and options cannot both be specified'
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 get_more_operation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_more_operation
spec = {
session: @session,
db_name: database.name,
coll_name: collection_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 convert_max_staleness
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def convert_max_staleness(name, value)
int = if value.is_a?(String) && /\A-?\d+\z/ =~ value
value.to_i
elsif value.is_a?(Integer)
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 parse_uri_options!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_uri_options!(string)
uri_options = {}
unless string
return uri_options
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 can_hint?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def can_hint?(connection)
gte_4_2 = connection.server.description.server_version_gte?('4.2')
gte_4_4 = connection.server.description.server_version_gte?('4.4')
op_combiner.requests.all? do |req|
op = req.keys.first
- 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 maybe_encrypt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def maybe_encrypt(connection, context)
# TODO verify compression happens later, i.e. when this method runs
# the message is not compressed.
if context.encrypt?
if connection.description.max_wire_version < 8
- 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 number_returned
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def number_returned
if doc = documents.first
if cursor = doc['cursor']
if batch = cursor['firstBatch'] || cursor['nextBatch']
return batch.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 to_document
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_document
return BSON::Document.new if empty?
if access_token
BSON::Document.new({ accessToken: access_token })
- 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 execute_operation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute_operation(name, values, connection, context, operation_id, result_combiner, session, txn_num = nil)
validate_collation!(connection)
validate_array_filters!(connection)
validate_hint!(connection)
- 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 wait_for_stop
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def wait_for_stop
# Wait for the thread to die. This is important in order to reliably
# clean up resources like connections knowing that no background
# thread will reconnect because it is still working.
#
- 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 open_download_stream_by_name
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def open_download_stream_by_name(filename, opts = {}, &block)
revision = opts.fetch(:revision, -1)
if revision < 0
skip = revision.abs - 1
sort = { 'uploadDate' => Mongo::Index::DESCENDING }
- 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 return_ocsp_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def return_ocsp_response(resp, errors = nil)
if resp
if resp.cert_status == OpenSSL::OCSP::V_CERTSTATUS_REVOKED
raise_revoked_error(resp)
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 to_document
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_document
return BSON::Document.new if empty?
if access_token
BSON::Document.new({ accessToken: access_token })
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 set_cert_verification
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_cert_verification(context, options)
context.verify_mode = OpenSSL::SSL::VERIFY_PEER
cert_store = OpenSSL::X509::Store.new
if options[:ssl_ca_cert]
cert_store.add_file(options[:ssl_ca_cert])
- 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 to_document
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_document
return BSON::Document.new({}) if @empty
BSON::Document.new({
provider: 'gcp',
projectId: project_id,
- 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
Avoid too many return
statements within this method. Open
return :primary if primary?
Avoid too many return
statements within this method. Open
return :other if other?
Avoid too many return
statements within this method. Open
return :secondary if secondary?
Avoid too many return
statements within this method. Open
return :standalone if standalone?
Avoid too many return
statements within this method. Open
return nil