lib/volt/models/persistors/array_store.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class ArrayStore has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

    class ArrayStore < Store
      include StoreState


      @@query_pool = QueryListenerPool.new
Severity: Minor
Found in lib/volt/models/persistors/array_store.rb - About 2 hrs to fix

    Method query_listener has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def query_listener
            return @query_listener if @query_listener
    
            collection = @model.path.last
            query = @query
    Severity: Minor
    Found in lib/volt/models/persistors/array_store.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 stop_listening has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def stop_listening
            Timers.client_set_timeout(5000) do
              Computation.run_without_tracking do
                if @listener_event_counter.count == 0
                  if @added_to_query
    Severity: Minor
    Found in lib/volt/models/persistors/array_store.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 fetch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def fetch(&block)
            Volt.logger.warn('Deprication warning: in 0.9.3.pre4, all query methods on store now return Promises, so you can juse use .all or .first instead of .fetch')
            promise = Promise.new
    
            # Run the block after resolve if a block is passed in
    Severity: Minor
    Found in lib/volt/models/persistors/array_store.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