BookingSync/synced

View on GitHub
lib/synced/strategies/full.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class Full has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Full
      include AttributesAsHash

      # Initializes new Full sync strategy
      #
Severity: Minor
Found in lib/synced/strategies/full.rb - About 2 hrs to fix

    Method remote_objects_persistor has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def remote_objects_persistor
            lambda do |remote_objects_batch|
              additional_errors_check
              remote_objects_batch_ids = remote_objects_batch.map(&:id)
              local_objects = relation_scope.where(@id_key => remote_objects_batch_ids)
    Severity: Minor
    Found in lib/synced/strategies/full.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 remote_objects_persistor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def remote_objects_persistor
            lambda do |remote_objects_batch|
              additional_errors_check
              remote_objects_batch_ids = remote_objects_batch.map(&:id)
              local_objects = relation_scope.where(@id_key => remote_objects_batch_ids)
    Severity: Minor
    Found in lib/synced/strategies/full.rb - About 1 hr to fix

      Method api_request_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def api_request_options
              {}.tap do |options|
                options[:include] = @associations if @associations.present?
                if @include.present?
                  options[:include] ||= []
      Severity: Minor
      Found in lib/synced/strategies/full.rb - About 35 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

      There are no issues that match your filters.

      Category
      Status