BookingSync/synced

View on GitHub

Showing 7 of 7 total issues

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_tester has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

          def remote_objects_tester
            lambda do |remote_objects_batch|
              remote_objects_batch_ids = remote_objects_batch.map(&:id)
              local_objects = relation_scope.where(@id_key => remote_objects_batch_ids)
              local_objects_hash = local_objects.each_with_object({}) do |local_object, hash|
    Severity: Minor
    Found in lib/synced/strategies/check.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 synchronize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def synchronize(scope: scope_from_relation, strategy: synced_strategy, **options)
          options.assert_valid_keys(:api, :fields, :include, :remote, :remove, :query_params, :association_sync, :auto_paginate, :transaction_per_page)
          options[:remove]  = synced_remove unless options.has_key?(:remove)
          options[:include] = Array.wrap(synced_include) unless options.has_key?(:include)
          options[:fields]  = Array.wrap(synced_fields) unless options.has_key?(:fields)
    Severity: Minor
    Found in lib/synced/model.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 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 synced has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def synced(strategy: :updated_since, **options)
          options.assert_valid_keys(:associations, :data_key, :fields, :globalized_attributes,
            :id_key, :include, :initial_sync_since, :local_attributes, :mapper, :only_updated,
            :remove, :auto_paginate, :transaction_per_page, :delegate_attributes, :query_params,
            :timestamp_strategy, :handle_processed_objects_proc, :tolerance, :endpoint)
    Severity: Minor
    Found in lib/synced/model.rb - About 1 hr to fix

      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

        Severity
        Category
        Status
        Source
        Language