Showing 393 of 447 total issues
Class Base
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
# Initialize the server selector.
#
# @example Initialize the selector.
Method initialize
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options, monitoring, cluster)
options = validate_options(options, cluster)
@options = options
@monitoring = monitoring
- 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 stale_primary?
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def stale_primary?
if updated_desc.max_wire_version >= 17
if updated_desc.election_id.nil? && !topology.max_election_id.nil?
return true
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
Class Socket
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Socket
include ::Socket::Constants
# Error message for TLS related exceptions.
#
Class MapReduce
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class MapReduce
extend Forwardable
include Enumerable
include Immutable
include Loggable
Class Message
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Message
include Id
include Serializers
# The batch size constant.
File readable.rb
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mongo
class Collection
class View
# Defines read related behavior for collection view.
Method validate_new_options!
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_new_options!(opts)
return Options::Redacted.new unless opts
if opts[:read_concern]
# Raise an error for non user-settable options
if opts[:read_concern][:after_cluster_time]
Class FSBucket
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class FSBucket
extend Forwardable
# The default root prefix.
#
Method update_rs_from_primary
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_rs_from_primary
if topology.replica_set_name.nil?
@topology = Topology::ReplicaSetWithPrimary.new(
topology.options.merge(replica_set_name: updated_desc.replica_set_name),
topology.monitoring, self)
Method ruby_to_smc
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def ruby_to_smc(opts)
rv = {}
URI_OPTION_MAP.each do |uri_key, spec|
if spec[:group]
v = opts[spec[:group]]
- 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 ruby_to_string
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def ruby_to_string(opts)
rv = {}
URI_OPTION_MAP.each do |uri_key, spec|
if spec[:group]
v = opts[spec[:group]]
- 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_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
File cursor.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mongo
# Client-side representation of an iterator over a query result set on
# the server.
#
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 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 each
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def each
# If the caching cursor is closed and was not fully iterated,
# the documents we have in it are not the complete result set and
# we have no way of completing that iteration.
# Therefore, discard that cursor and start iteration again.
- 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 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def standard_dependencies
gem 'yard', '>= 0.9.35'
gem 'ffi'
group :development, :testing do
Method commit_transaction
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def commit_transaction(options=nil)
QueryCache.clear
check_if_ended!
check_if_no_transaction!
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'),