Class InMemoryRepository
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class InMemoryRepository
class UnsupportedVersionAnyUsage < StandardError
def initialize
super <<~EOS
Mixing expected version :any and specific position (or :auto) is unsupported.
Method read_scope
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def read_scope(spec)
serialized_records = serialized_records_of_stream(spec.stream)
serialized_records = ordered(serialized_records, spec)
serialized_records = serialized_records.select { |e| spec.with_ids.any? { |x| x.eql?(e.event_id) } } if spec
.with_ids?
- Read upRead up
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 link_to_stream
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def link_to_stream(event_ids, stream, expected_version)
serialized_records = event_ids.map { |id| read_event(id) }
with_synchronize(expected_version, stream) do |resolved_version|
ensure_supported_any_usage(resolved_version, stream)
- Read upRead up
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 ensure_supported_any_usage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ensure_supported_any_usage(resolved_version, stream)
if @ensure_supported_any_usage
stream_positions = streams.fetch(stream.name, Array.new).map(&:position)
if resolved_version.nil?
raise UnsupportedVersionAnyUsage if !stream_positions.compact.empty?
- Read upRead up
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 append_to_stream
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def append_to_stream(records, stream, expected_version)
serialized_records = records.map { |record| record.serialize(serializer) }
with_synchronize(expected_version, stream) do |resolved_version|
ensure_supported_any_usage(resolved_version, stream)
- Read upRead up
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"