eventstore-rb/estore

View on GitHub

Showing 4 of 6 total issues

File messages.rb has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'beefcake'

module Estore
  module OperationResult
    Success = 0
Severity: Minor
Found in lib/estore/messages.rb - About 3 hrs to fix

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

          def keep_reading(response)
            events = Array(response.events)
    
            @from += events.size
            read(@stream, @from, @batch_size) unless response.is_end_of_stream
    Severity: Minor
    Found in lib/estore/commands/reads/forward.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def initialize(connection, stream, from, batch_size = nil, &block)
    Severity: Minor
    Found in lib/estore/commands/reads/forward.rb - About 35 mins to fix

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

            def event_appeared(response)
              unless @caught_up
                @mutex.synchronize do
                  @while_catching_up << response.event unless @caught_up
                end
      Severity: Minor
      Found in lib/estore/commands/subscriptions/catch_up.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