maestrano/maestrano-connector-rails

View on GitHub
app/jobs/maestrano/connector/rails/concerns/synchronization_job.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Method perform has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
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
Severity: Minor
Found in app/jobs/maestrano/connector/rails/concerns/synchronization_job.rb - About 2 hrs to fix

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

  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
Severity: Minor
Found in app/jobs/maestrano/connector/rails/concerns/synchronization_job.rb - About 1 hr to fix

    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)
    Severity: Major
    Found in app/jobs/maestrano/connector/rails/concerns/synchronization_job.rb - About 50 mins to fix

      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)
      Severity: Minor
      Found in app/jobs/maestrano/connector/rails/concerns/synchronization_job.rb - About 45 mins to fix

        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
        Severity: Minor
        Found in app/jobs/maestrano/connector/rails/concerns/synchronization_job.rb - About 45 mins to fix

        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

            def instanciate_entity(entity_name, organization, connec_client, external_client, opts)
        Severity: Minor
        Found in app/jobs/maestrano/connector/rails/concerns/synchronization_job.rb - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status