Showing 423 of 480 total issues
Method initialize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(address, cluster, monitoring, event_listeners, options = {})
@address = address
@cluster = cluster
@monitoring = monitoring
options = options.dup
Method initial
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initial(cluster, monitoring, options)
connect = options[:connect]&.to_sym
cls = if options[:direct_connection]
if connect && connect != :direct
raise ArgumentError, "Conflicting topology options: direct_connection=true and connect=#{connect}"
Method change_doc
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def change_doc
{}.tap do |doc|
if @options[:full_document]
doc[:fullDocument] = @options[:full_document]
end
Method validate_requests!
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def validate_requests!
requests_empty = true
@requests.each do |req|
requests_empty = false
if op = req.keys.first
Method initialize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(flags, options, main_document, *sequences)
if flags
flags.each do |flag|
unless KNOWN_FLAGS.key?(flag)
raise ArgumentError, "Unknown flag: #{flag.inspect}"
Method unknown!
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def unknown!(options = {})
pool = pool_internal
if load_balancer?
# When the client is in load-balanced topology, servers (the one and
Method insert_one
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def insert_one(document, opts = {})
QueryCache.clear_namespace(namespace)
client.with_session(opts) do |session|
write_concern = if opts[:write_concern]
Method start_transaction
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def start_transaction(options = nil)
check_transactions_supported!
if options
Lint.validate_read_concern_option(options[:read_concern])
Method update_rs_with_primary_from_member
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def update_rs_with_primary_from_member
if topology.replica_set_name != updated_desc.replica_set_name
log_warn(
"Removing server #{updated_desc.address.to_s} because it has an " +
"incorrect replica set name (#{updated_desc.replica_set_name}); " +
Method initialize
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(view, result, server, options = {})
unless result.is_a?(Operation::Result)
raise ArgumentError, "Second argument must be a Mongo::Operation::Result: #{result.inspect}"
end
Method initialize
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(user, used_mechanism: nil, message: nil,
server: nil, code: nil
)
@code = code
Method validate_param
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def validate_param(key, opts, format_hint, required: true)
value = opts.fetch(key)
return nil if value.nil? && !required
if value.nil?
raise ArgumentError.new(
Method spawn_mongocryptd
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def spawn_mongocryptd
mongocryptd_spawn_args = @options[:mongocryptd_spawn_args]
mongocryptd_spawn_path = @options[:mongocryptd_spawn_path]
unless mongocryptd_spawn_path
Method initialize
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(address, config = {}, average_round_trip_time: nil,
minimum_round_trip_time: 0, load_balancer: false,
force_load_balancer: false
)
@address = address
Method create_many
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def create_many(*models)
models = models.flatten
options = {}
if models && !models.last.key?(:key)
options = models.pop
Method create_context
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method ruby_to_string
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def ruby_to_string(opts)
rv = {}
URI_OPTION_MAP.each do |uri_key, spec|
if spec[:group]
v = opts[spec[:group]]
Method ruby_to_smc
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def ruby_to_smc(opts)
rv = {}
URI_OPTION_MAP.each do |uri_key, spec|
if spec[:group]
v = opts[spec[:group]]
Method normalized?
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.normalized?(string, form = :nfc)
encoding = string.encoding
case encoding
when Encoding::UTF_8
case form
Method do_clear
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def do_clear(options = nil)
check_invariants
service_id = options && options[:service_id]