Showing 423 of 480 total issues
Method create_context
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def create_context(options)
OpenSSL::SSL::SSLContext.new.tap do |context|
if OpenSSL::SSL.const_defined?(:OP_NO_RENEGOTIATION)
context.options = context.options | OpenSSL::SSL::OP_NO_RENEGOTIATION
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 commit_transaction
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def commit_transaction(options=nil)
QueryCache.clear
check_if_ended!
check_if_no_transaction!
Class SdamFlow
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class SdamFlow
extend Forwardable
def initialize(cluster, previous_desc, updated_desc, awaited: false)
@cluster = cluster
Method standard_dependencies
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def standard_dependencies
gem 'yard', '>= 0.9.35'
gem 'ffi'
group :development, :testing do
Method validate_authentication_options!
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def validate_authentication_options!
auth_mech = options[:auth_mech]
user = options[:user]
password = options[:password]
auth_source = options[:auth_source]
- 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_find_timeouts_to
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def apply_find_timeouts_to(spec, timeout_ms)
view = context&.view
return spec unless view
case view.cursor_type
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
def connect!
sockaddr = ::Socket.pack_sockaddr_in(port, host)
connect_timeout = options[:connect_timeout]
map_exceptions do
if connect_timeout && connect_timeout != 0
- 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 run
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
opts = {
region: ENV.fetch('MONGO_RUBY_DRIVER_AWS_AUTH_REGION'),
access_key_id: ENV.fetch('MONGO_RUBY_DRIVER_AWS_AUTH_ACCESS_KEY_ID'),
secret_access_key: ENV.fetch('MONGO_RUBY_DRIVER_AWS_AUTH_SECRET_ACCESS_KEY'),
Method deliver
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def deliver(message, context, options = {})
if Lint.enabled? && !@socket
raise Error::LintError, "Trying to deliver a message over a disconnected connection (to #{address})"
end
buffer = serialize(message, context)
Method abort_transaction
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def abort_transaction(options = nil)
QueryCache.clear
check_if_ended!
check_if_no_transaction!
Method run_benchmark
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def run_benchmark
[].tap do |timings|
iteration_count = 0
cumulative_time = 0
- 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 normalized?
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.normalized?(string, form = :nfc)
encoding = string.encoding
case encoding
when Encoding::UTF_8
case form
- 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 add_read_preference
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def add_read_preference(sel, connection)
Lint.assert_type(connection, Server::Connection)
# https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.rst#topology-type-single
read_doc = if connection.description.standalone?
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
def each
# If we already iterated past the first batch (i.e., called get_more
# at least once), the cursor on the server side has advanced past
# the first batch and restarting iteration from the beginning by
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
def initialize(opts)
@opts = opts
return if empty?
if opts[: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 retry_read
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def retry_read(original_error, session, server_selector, context: nil, failed_server: nil, &block)
server = select_server_for_retry(
original_error, session, server_selector, context, failed_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 initialize
has 46 lines of code (exceeds 25 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
Method kill_cursors
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def kill_cursors
# TODO optimize this to batch kill cursor operations for the same
# server/database/collection instead of killing each cursor
# individually.
loop do
Method add_txn_opts!
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_txn_opts!(command, read, context)
command.tap do |c|
# The read concern should be added to any command that starts a transaction.
if starting_transaction?
# https://jira.mongodb.org/browse/SPEC-1161: transaction's
Method handshake_and_authenticate!
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def handshake_and_authenticate!
speculative_auth_doc = nil
if options[:user] || options[:auth_mech]
# To create an Auth instance, we need to specify the mechanism,
# but at this point we don't know the mechanism that ultimately
- 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"