Showing 423 of 480 total issues
Method set_crypto_hooks
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_crypto_hooks
@aes_encrypt = Proc.new do |_, key_binary_p, iv_binary_p, input_binary_p,
output_binary_p, response_length_p, status_p|
do_aes(
key_binary_p,
Method verify_one_responder
has 89 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
File socket.rb
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'mongo/socket/ssl'
require 'mongo/socket/tcp'
require 'mongo/socket/unix'
require 'mongo/socket/ocsp_verifier'
require 'mongo/socket/ocsp_cache'
Class Socket
has 29 methods (exceeds 20 allowed). Consider refactoring. Open
class Socket
include ::Socket::Constants
# Error message for TLS related exceptions.
#
Method initialize
has 87 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 change_doc
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def change_doc
{}.tap do |doc|
if @options[:full_document]
doc[:fullDocument] = @options[:full_document]
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 uri.rb
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mongo
# The URI class provides a way for users to parse the MongoDB uri as
# defined in the connection string format spec.
#
Method server_description_changed
has 84 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
Class Result
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Result
extend Forwardable
include Enumerable
# The field name for the cursor document in an aggregation.
Method kill_cursors
has a Cognitive Complexity of 23 (exceeds 5 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
- 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 description.rb
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mongo
class Server
# Represents a description of the server, populated by the result of the
# hello command.
File readable.rb
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mongo
class Collection
class View
# Defines read related behavior for collection view.
Method estimated_document_count
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def estimated_document_count(opts = {})
unless view.filter.empty?
raise ArgumentError, "Cannot call estimated_document_count when querying with a filter"
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 parse!
has a Cognitive Complexity of 22 (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 initialize
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def initialize(options)
Crypt.validate_ffi!
# Note that this call may eventually, via other method invocations,
# create additional clients which have to be cleaned up.
@options = set_default_options(options).freeze
- 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 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
File cursor.rb
has 290 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.
#
Method commit_transaction
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def commit_transaction(options=nil)
QueryCache.clear
check_if_ended!
check_if_no_transaction!
- 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 ssl.rb
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Mongo
class Socket
# Wrapper for TLS sockets.
#
Method validate_uri_options!
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_uri_options!
# The URI options spec requires that we raise an error if there are conflicting values of
# 'tls' and 'ssl'. In order to fulfill this, we parse the values of each instance into an
# array; assuming all values in the array are the same, we replace the array with that value.
unless uri_options[:ssl].nil? || uri_options[:ssl].empty?