Showing 24 of 28 total issues
Class Node
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class Node
include Executable
include Instrumentable
# @!attribute address
Class Query
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Query
include Enumerable
include Retryable
# @attribute [r] collection The collection to execute the query on.
Method refresh
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def refresh(nodes_to_refresh = seeds)
refreshed_nodes = []
seen = {}
# Set up a recursive lambda function for refreshing a node and it's peers.
refresh_node = ->(node) 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
Method resolve
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def resolve(node)
return @resolved if @resolved
start = Time.now
retries = 0
begin
- 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 Session
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Session
include Optionable
# @!attribute cluster
# @return [ Cluster ] The cluster of nodes.
Method execute
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def execute(node)
node.process(operation) do |reply|
# Avoid LocalJumpError
ret = nil
if reply.unauthorized? && node.credentials.key?(@database)
- 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 flags
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def flags(name, flag_map = {})
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{name}
@#{name} ||= []
end
Method resolve
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolve(node)
return @resolved if @resolved
start = Time.now
retries = 0
begin
Method refresh_peers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def refresh_peers(node, &block)
node.peers.each do |node|
if node.address.resolved
block.call(node) unless seeds.include?(node)
peers.push(node) unless peers.include?(node)
- 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 int64
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def int64(name, options = {})
attr_writer name
if options[:type] == :array
class_eval <<-RUBY, __FILE__, __LINE__ + 1
Method with_retry
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def with_retry(cluster, retries = cluster.max_retries, &block)
begin
block.call
rescue Errors::ConnectionFailure, Errors::PotentialReconfiguration => e
raise e if e.is_a?(Errors::PotentialReconfiguration) &&
- 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 ensure_connected
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ensure_connected(&block)
unless (conn = stack(:connection)).empty?
return yield(conn.first)
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 update
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def update(database, collection, selector, change, concern, options = {})
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(database, collection, selector, update, options = {})
Method remove
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def remove(database, collection, selector, concern, options = {})
Method insert
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def insert(database, collection, documents, concern, options = {})
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(database, collection, cursor_id, limit, options = {})
Method refresh
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def refresh
if address.resolve(self)
begin
@refreshed_at = Time.now
configure(command("admin", ismaster: 1))
- 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 alive?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def alive?
if Kernel::select([ self ], nil, [ self ], 0)
!eof? rescue false
else
true
- 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 modify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def modify(change, options = {})
command = {
findAndModify: collection.name,
query: selector
}.merge(options)
- 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"