Dynamoid/dynamoid

View on GitHub
lib/dynamoid/criteria/chain.rb

Summary

Maintainability
C
1 day
Test Coverage

Class Chain has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

    class Chain
      attr_reader :source, :consistent_read, :key_fields_detector

      include Enumerable

Severity: Minor
Found in lib/dynamoid/criteria/chain.rb - About 4 hrs to fix

    File chain.rb has 300 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_relative 'key_fields_detector'
    require_relative 'nonexistent_fields_detector'
    require_relative 'where_conditions'
    
    module Dynamoid
    Severity: Minor
    Found in lib/dynamoid/criteria/chain.rb - About 3 hrs to fix

      Method field_condition has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def field_condition(key, value_before_type_casting)
              name, operator = key.to_s.split('.')
              value = type_cast_condition_parameter(name, value_before_type_casting)
              operator ||= 'eq'
      
      
      Severity: Minor
      Found in lib/dynamoid/criteria/chain.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 delete_all has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def delete_all
              ids = []
              ranges = []
      
              if @key_fields_detector.key_present?
      Severity: Minor
      Found in lib/dynamoid/criteria/chain.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 query_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def query_options
              opts = {}
              # Don't specify select = ALL_ATTRIBUTES option explicitly because it's
              # already a default value of Select statement. Explicite Select value
              # conflicts with AttributesToGet statement (project option).
      Severity: Minor
      Found in lib/dynamoid/criteria/chain.rb - About 25 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 scan_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def scan_options
              opts = {}
              opts[:index_name] = @key_fields_detector.index_name if @key_fields_detector.index_name
              opts[:record_limit] = @record_limit if @record_limit
              opts[:scan_limit] = @scan_limit if @scan_limit
      Severity: Minor
      Found in lib/dynamoid/criteria/chain.rb - About 25 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 start_key has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def start_key
              return @start if @start.is_a?(Hash)
      
              hash_key = @key_fields_detector.hash_key || source.hash_key
              range_key = @key_fields_detector.range_key || source.range_key
      Severity: Minor
      Found in lib/dynamoid/criteria/chain.rb - About 25 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