Showing 423 of 480 total issues
Method set_cert_verification
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_cert_verification(context, options)
context.verify_mode = OpenSSL::SSL::VERIFY_PEER
cert_store = OpenSSL::X509::Store.new
if options[:ssl_ca_cert]
cert_store.add_file(options[:ssl_ca_cert])
- 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
Avoid too many return
statements within this method. Open
return :primary if primary?
Avoid too many return
statements within this method. Open
return nil
Avoid too many return
statements within this method. Open
return :other if other?
Avoid too many return
statements within this method. Open
return :secondary if secondary?
Avoid too many return
statements within this method. Open
return :standalone if standalone?
Avoid too many return
statements within this method. Open
return true
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return false
Method prepare_web_identity_inputs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prepare_web_identity_inputs
token_file = ENV['AWS_WEB_IDENTITY_TOKEN_FILE']
role_arn = ENV['AWS_ROLE_ARN']
if token_file.nil? || role_arn.nil?
return nil
- 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 prune!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prune!
# Load balancers spec explicitly requires not to prune sessions.
# No rationale is provided as of the time of this writing.
return if @cluster.load_balanced?
- 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 detect_container
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def detect_container
runtime = docker_present? && 'docker'
orchestrator = kubernetes_present? && 'kubernetes'
return unless runtime || orchestrator
- 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 region
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def region
# Common case
if host == 'sts.amazonaws.com'
return 'us-east-1'
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 build_message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_message(connection, auth_source, selector)
if connection && connection.features.op_msg_enabled?
selector = selector.dup
selector[Protocol::Msg::DATABASE_IDENTIFIER] = auth_source
cluster_time = connection.mongos? && connection.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 handshake!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def handshake!(speculative_auth_doc: nil)
unless socket
raise Error::InternalDriverError, "Cannot handshake because there is no usable socket (for #{address})"
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_camel_case_read_preference_mode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_camel_case_read_preference_mode(mode)
return unless enabled?
if mode
unless %w(primary primaryPreferred secondary secondaryPreferred nearest).include?(mode.to_s)
raise Error::LintError, "Invalid read preference mode: #{mode}"
- 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"