lib/mongo/crypt/handle.rb
Method set_crypto_hooks
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
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 initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(kms_providers, kms_tls_options, options={})
# FFI::AutoPointer uses a custom release strategy to automatically free
# the pointer once this object goes out of scope
@mongocrypt = FFI::AutoPointer.new(
Binding.mongocrypt_new,
Method maybe_set_schema_map
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def maybe_set_schema_map(options)
if !options[:schema_map] && !options[:schema_map_path]
@schema_map = nil
elsif options[:schema_map] && options[:schema_map_path]
raise ArgumentError.new(
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def initialize(kms_providers, kms_tls_options, options={})
# FFI::AutoPointer uses a custom release strategy to automatically free
# the pointer once this object goes out of scope
@mongocrypt = FFI::AutoPointer.new(
Binding.mongocrypt_new,
- 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 do_aes
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def do_aes(key_binary_p, iv_binary_p, input_binary_p, output_binary_p,
response_length_p, status_p, decrypt: false, mode: :CBC)
Method do_hmac_sha
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def do_hmac_sha(digest_name, key_binary_p, input_binary_p,
output_binary_p, status_p)