app/jobs/maestrano/connector/rails/concerns/synchronization_job.rb
Method perform
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
def perform(organization_id, opts = {})
organization = Maestrano::Connector::Rails::Organization.find(organization_id)
return unless organization&.sync_enabled
# Check if previous synchronization is still running
- 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 perform
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def perform(organization_id, opts = {})
organization = Maestrano::Connector::Rails::Organization.find(organization_id)
return unless organization&.sync_enabled
# Check if previous synchronization is still running
Method first_sync_entity
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def first_sync_entity(entity_name, organization, connec_client, external_client, last_synchronization_date, opts, external = true)
Method sync_entity
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
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
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 instanciate_entity
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def instanciate_entity(entity_name, organization, connec_client, external_client, opts)