maestrano/maestrano-connector-rails

View on GitHub
app/jobs/maestrano/connector/rails/push_to_connec_job.rb

Summary

Maintainability
A
3 hrs
Test Coverage

Method perform has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def perform(organization, entities_hash, opts = {})
      return unless organization.sync_enabled && organization.oauth_uid

      connec_client = Maestrano::Connector::Rails::ConnecHelper.get_client(organization)
      external_client = Maestrano::Connector::Rails::External.get_client(organization)
Severity: Minor
Found in app/jobs/maestrano/connector/rails/push_to_connec_job.rb - About 1 hr 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 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)
Severity: Minor
Found in app/jobs/maestrano/connector/rails/push_to_connec_job.rb - About 55 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 find_entity_instance has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

    There are no issues that match your filters.

    Category
    Status