Showing 24 of 24 total issues
Method prototype_match_score
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def prototype_match_score(prototype, strict = false)
# The prototype contains keys that are not in the Hash. That's a failure,
# and the level of failure is the number of missing keys.
missing = (prototype.keys - keys).length
if missing > 0
- 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 create_proc
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create_proc(write_access)
return proc do |wrapped_method, *args, &block|
# If there are no arguments, there's nothing to do with paths. Just
# delegate to the hash.
if args.empty?
- 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 wrappers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def wrappers(base, method_name, visited = nil)
# First, check the instance, then its class for a wrapper. If either of
# them succeeds, exit with a result.
[base, base.class].each do |item|
item_wrappers = item.instance_variable_get(WRAPPER_HASH)
- 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 recursive_fetch_all
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def recursive_fetch_all(key, default = nil, &block)
result = []
# Start simple at the top level.
# rubocop:disable Lint/HandleExceptions
- 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_helpers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def resolve_helpers(base, method_name, raise_on_missing)
# The base class must define an instance method of method_name, otherwise
# this will NameError. That's also a good check that sensible things are
# being done.
base_method = 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 recursive_fetch_one
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def recursive_fetch_one(key, default = nil, &block)
# Start simple at the top level.
# rubocop:disable Lint/HandleExceptions
begin
result = fetch(key, default)
- 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 prototype_match_score
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prototype_match_score(prototype, strict = false)
# The prototype contains keys that are not in the Hash. That's a failure,
# and the level of failure is the number of missing keys.
missing = (prototype.keys - keys).length
if missing > 0
Method wrappers
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def wrappers(base, method_name, visited = nil)
# First, check the instance, then its class for a wrapper. If either of
# them succeeds, exit with a result.
[base, base.class].each do |item|
item_wrappers = item.instance_variable_get(WRAPPER_HASH)
Method wrap_method
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def wrap_method(base, method_name, options = {}, &wrapper_block)
# Option defaults (need to check for nil if we default to true)
if options[:raise_on_missing].nil?
options[:raise_on_missing] = true
end
Method merger
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def merger(the_self, v1, v2, overwrite)
if v1.is_a? Hash and v2.is_a? Hash
v1 = ViralCapabilities.enhance_value(the_self, v1)
v2 = ViralCapabilities.enhance_value(the_self, v2)
- 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 environment_variables_for_key
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def environment_variables_for_key(receiver, key)
env_keys = []
if receiver.respond_to?(:path_prefix)
# If we have a prefix, use it.
- 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 recursive_fetch_all
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def recursive_fetch_all(key, default = nil, &block)
result = []
# Start simple at the top level.
# rubocop:disable Lint/HandleExceptions
Method environment_variables_for_key
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def environment_variables_for_key(receiver, key)
env_keys = []
if receiver.respond_to?(:path_prefix)
# If we have a prefix, use it.
Method merger
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def merger(the_self, v1, v2, overwrite)
if v1.is_a? Hash and v2.is_a? Hash
v1 = ViralCapabilities.enhance_value(the_self, v1)
v2 = ViralCapabilities.enhance_value(the_self, v2)
Method wrap_method
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def wrap_method(base, method_name, options = {}, &wrapper_block)
# Option defaults (need to check for nil if we default to true)
if options[:raise_on_missing].nil?
options[:raise_on_missing] = true
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 enhance_hash_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def enhance_hash_value(parent, value, *args)
# If the value is not of the best ancestor type, make sure it becomes
# that type.
# XXX: DO NOT replace the loop with :merge! or :merge - those are
# potentially wrapped write functions, leading to an infinite
- 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 override_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def override_value(variables, receiver, key)
value = nil
variables.each do |env_key|
# Grab the environment value; skip if there's nothing there.
env_value = ENV[env_key]
- 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 key_permutations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def key_permutations(key)
tries = [key]
if key.is_a? Symbol
key_s = key.to_s
tries << key_s
- 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 recursive_dup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def recursive_dup
ret = map do |k, v|
# Hash values, recurse into them.
if v.is_a?(Hash)
n = ViralCapabilities.enhance_hash_value(self, v)
- 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 score