Showing 8 of 27 total issues
Class BackendProxy
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class BackendProxy
# Available backends (supported platforms)
BACKEND_TYPES = {
dummy: Backends::Dummy,
opennebula: Backends::Opennebula
Method transfer_attributes!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def transfer_attributes!(source, target, mappers)
raise Errors::Backend::InternalError, '`mappers` must be enumerable' unless mappers.is_a? Enumerable
unless target.respond_to?(:[]=) && target.respond_to?(:attributes)
raise Errors::Backend::InternalError, '`target` must be Entity-like'
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 add_floatingippools!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_floatingippools!(model, skeleton)
pool(:virtual_network, :info_all).each do |vnet|
next if vnet['PARENT_NETWORK_ID'].present? || vnet['TEMPLATE/FLOATING_IP_POOL'].blank?
next unless vnet['TEMPLATE/FLOATING_IP_POOL'].casecmp('yes')
- 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 client
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def client(e_klass)
raise Errors::Backend::InternalError, 'Block is a mandatory argument for client calls' unless block_given?
if ERROR_CONNECT.include?(e_klass)
raise Errors::Backend::InternalError, "Error #{e_klass} cannot be used with this wrapper"
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 resource_tpl_by_size
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def resource_tpl_by_size(virtual_machine, comparable_attributes)
return unless virtual_machine
server_model.find_resource_tpls.detect do |resource_tpl|
comparable_attributes.reduce(true) do |match, (key, val)|
tpl_val = resource_tpl[key] ? resource_tpl[key].default : 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 read_decrypted
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def read_decrypted(token)
return unless token
parts = token.split(INTERNAL_TOKEN_SEPARATOR)
if parts.count != 2 || parts[0].blank? || parts[1].blank?
- 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 set_cluster!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_cluster!(template, compute)
az = compute.availability_zone ? compute.availability_zone.term : nil
return unless az
sched_reqs = template['TEMPLATE/SCHED_REQUIREMENTS'] || ''
- 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 decrypt_unwrapped
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decrypt_unwrapped(token)
return unless token
return token if app_config['token_cipher'].blank?
logger.debug "Decrypting token as #{app_config['token_cipher'].inspect}"
- 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"