Showing 312 of 370 total issues
Method verify_one_responder
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
def verify_one_responder(uri)
original_uri = uri
redirect_count = 0
http_response = nil
loop do
Class Collection
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Collection
extend Forwardable
include Retryable
# The capped option.
Class View
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class View
# Defines read related behavior for collection view.
#
# @since 2.0.0
File options_mapper.rb
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mongo
class URI
# Performs mapping between URI options and Ruby options.
#
Method check_out
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_out
check_invariants
publish_cmap_event(
Monitoring::Event::Cmap::ConnectionCheckOutStarted.new(@server.address)
Method server_description_changed
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def server_description_changed
@previous_server_descriptions = servers_list.map do |server|
[server.address.to_s, server.description]
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 Cluster
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Cluster
extend Forwardable
include Monitoring::Publishable
include Event::Subscriber
include Loggable
Class Binding
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Binding
extend FFI::Library
begin
ffi_lib ENV['LIBMONGOCRYPT_PATH']
Method parse!
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def parse!(remaining)
hosts_and_db, options = remaining.split('?', 2)
if options && options.index('?')
raise_invalid_error!("Options contain an unescaped question mark (?), or the database name contains a question mark and was not escaped")
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_new_options!
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def validate_new_options!(opts = Options::Redacted.new)
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]
- 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 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(seeds, monitoring, options = Options::Redacted.new)
if seeds.nil?
raise ArgumentError, 'Seeds cannot be nil'
end
Method select_server
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_server(cluster, ping = nil, session = nil)
server_selection_timeout = cluster.options[:server_selection_timeout] || SERVER_SELECTION_TIMEOUT
# Special handling for zero timeout: if we have to select a server,
# and the timeout is zero, fail immediately (since server selection
File base.rb
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mongo
module ServerSelector
class Base
Method initialize
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(addresses_or_uri, options = nil)
options = options ? options.dup : {}
srv_uri = nil
if addresses_or_uri.is_a?(::String)
Class Server
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Server
extend Forwardable
include Monitoring::Publishable
include Event::Publisher
Method initialize
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def initialize(seeds, monitoring, options = Options::Redacted.new)
if seeds.nil?
raise ArgumentError, 'Seeds cannot be nil'
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 with_transaction
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def with_transaction(options=nil)
# Non-configurable 120 second timeout for the entire operation
deadline = Time.now + 120
transaction_in_progress = false
loop do
Class ScramConversationBase
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class ScramConversationBase < SaslConversationBase
# The minimum iteration count for SCRAM-SHA-1 and SCRAM-SHA-256.
MIN_ITER_COUNT = 4096
Method server_description_changed
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def server_description_changed
@previous_server_descriptions = servers_list.map do |server|
[server.address.to_s, server.description]
end
Method initialize
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def initialize(addresses_or_uri, options = nil)
options = options ? options.dup : {}
srv_uri = nil
if addresses_or_uri.is_a?(::String)
- 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"