Showing 37 of 41 total issues
Method notifications
has 26 lines of code (exceeds 25 allowed). Consider refactoring. 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 batch_calls
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def batch_calls(array_with_idmap, proc, connec_entity_name, id_update_only = false)
request_per_call = @opts[:request_per_batch_call] || 50
start = 0
while start < array_with_idmap.size
# Prepare batch request
Method find_entity_instance
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_entity_instance(entity_name, organization, connec_client, external_client, opts)
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?('external_entities_names'.to_sym)
return {instance: clazz.new(organization, connec_client, external_client, opts), is_complex: true, name: entity_name_from_list} if clazz.external_entities_names.include?(entity_name)
- 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 map_to
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def map_to(name, entity, idmap = nil)
first_time_mapped = self.class.external? ? idmap&.last_push_to_connec.nil? : idmap&.last_push_to_external.nil?
mapper = first_time_mapped ? self.class.creation_mapper_classes[name] : self.class.mapper_classes[name]
raise "Impossible mapping from #{self.class.entity_name} to #{name}" unless mapper
- 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 first_sync_entity
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def first_sync_entity(entity_name, organization, connec_client, external_client, last_synchronization_date, opts, external = true)
Method generate_composite_filters
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.generate_composite_filters
_allowed_filters.keys.each do |key|
# iterating through all the api operator and adding them as custom filter
# name.gt, name.like etc...
next unless _model_class
- 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 sync_entity
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def sync_entity(entity_name, organization, connec_client, external_client, last_synchronization_date, opts)
Method first_sync_entity
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def first_sync_entity(entity_name, organization, connec_client, external_client, last_synchronization_date, opts, external = true)
limit = Settings.first_sync_batch_size || 50
skip = 0
entities_count = limit
last_first_record = 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 instantiate_sub_entity_instance
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def instantiate_sub_entity_instance(entity_name, organization, connec_client, external_client, opts)
Method find_entity_instance
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_entity_instance(entity_name, organization, connec_client, external_client, opts)
Method find_complex_entity_and_instantiate_external_sub_entity_instance
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_complex_entity_and_instantiate_external_sub_entity_instance(entity_name, organization, connec_client, external_client, opts)
Method solve_conflict
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def solve_conflict(connec_entity, external_entities, external_entity_name, idmap, id_refs_only_connec_entity)
Method instanciate_entity
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def instanciate_entity(entity_name, organization, connec_client, external_client, opts)
Method ensure_valid_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ensure_valid_options
valid_options = {
skip_gemfile: false,
skip_bundle: false,
skip_git: false
- 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 find_entity_class
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. 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"
Further reading
Method solve_conflict
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def solve_conflict(connec_entity, external_entities, external_entity_name, idmap, id_refs_only_connec_entity)
# Here the connec_entity['id'] is an external id (String) because the entity has been unfolded.
external_entity = external_entities.find { |entity| connec_entity['id'] == @current_entity.class.id_from_external_entity_hash(entity) }
# No conflict
return map_connec_entity_with_idmap(connec_entity, external_entity_name, idmap, id_refs_only_connec_entity) unless external_entity
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create
tenant = params[:tenant]
uid = params[:group_id]
opts = params[:opts] || {}
organization = Maestrano::Connector::Rails::Organization.find_by(uid: uid, tenant: tenant)
- 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"