app/controllers/maestrano/connec_controller.rb
Method notifications
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def notifications
begin
params.except(:tenant, :controller, :action, :connec).each do |entity_name, entities|
entity_class_hash = find_entity_class(entity_name)
next Maestrano::Connector::Rails::ConnectorLogger.log('info', nil, "Received notification from Connec! for unknow entity: #{entity_name}") unless entity_class_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 notifications
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def notifications
begin
params.except(:tenant, :controller, :action, :connec).each do |entity_name, entities|
entity_class_hash = find_entity_class(entity_name)
next Maestrano::Connector::Rails::ConnectorLogger.log('info', nil, "Received notification from Connec! for unknow entity: #{entity_name}") unless entity_class_hash
Method find_entity_class
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def find_entity_class(entity_name)
parametrised_entity_name = entity_name.parameterize('_').pluralize
Maestrano::Connector::Rails::External.entities_list.each do |entity_name_from_list|
clazz = "Entities::#{entity_name_from_list.singularize.titleize.split.join}".constantize
if clazz.methods.include?('connec_entities_names'.to_sym)
- 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"