Showing 48 of 48 total issues
Method handle_split
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_split(fetch_specification)
obtained_lock = obtain_lock_for_process(fetch_specification)
return false unless obtained_lock
something_processed = false
Method build_domain_event
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_domain_event(common_payload, operation, payload)
case operation
when :add
event_klass("ToggleAdded").new(data: common_payload)
when :remove
Method initialize
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(
direction: :forward,
start: nil,
stop: nil,
older_than: nil,
Method failure_message
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def failure_message(expected, events, stream_name = nil)
return failure_message_strict(expected, events) if expected.strict?
return failure_message_no_events if expected.empty?
expected.events.each do |expected_event|
correct_event_count = 0
Method handle_split
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def handle_split(fetch_specification)
obtained_lock = obtain_lock_for_process(fetch_specification)
return false unless obtained_lock
something_processed = false
- 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 read
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def read(spec)
stream = read_scope(spec)
if spec.batched?
spec.time_sort_by ? offset_limit_batch_reader(spec, stream) : monotonic_id_batch_reader(spec, stream)
elsif spec.first?
- 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 read_scope
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_scope(spec)
if spec.stream.global?
stream = @event_klass
stream = stream.where(event_id: spec.with_ids) if spec.with_ids?
stream = stream.where(event_type: spec.with_types) if spec.with_types?
Method read_scope
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_scope(specification)
direction = specification.forward? ? :forward : :backward
if specification.last? && !specification.start && !specification.stop
direction = specification.forward? ? :backward : :forward
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 append_to_stream
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def append_to_stream(records, stream, expected_version)
resolved_version = resolved_version(expected_version, stream)
@db.transaction do
records.map.with_index do |record, index|
Method link_to_stream
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def link_to_stream(event_ids, stream, expected_version)
(
event_ids -
@db[:event_store_events]
.select(::Sequel[:event_store_events][:event_id])
- 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 initialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(url: nil, **kwargs)
return super unless url
uri = URI.parse(url)
if uri.scheme == "unix"
- 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 decrypt_attribute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def decrypt_attribute(data, attribute, meta)
case meta
when Leaf
cryptogram = data.fetch(attribute)
return unless cryptogram
- 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 read
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def read(specification)
if specification.batched?
stream = read_(specification)
batch_reader = ->(offset, limit) { stream.offset(offset).limit(limit).map(&method(:record)) }
RubyEventStore::BatchEnumerator.new(specification.batch_size, specification.limit, batch_reader).each
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
expected_klass,
actual_klass,
expected_data,
actual_data,
expected_metadata,
Method add_to_stream
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_to_stream(event_ids, stream, expected_version)
last_stream_version = ->(stream_) do
@stream_klass.where(stream: stream_.name).order("position DESC").first.try(:position)
end
resolved_version = expected_version.resolve_for(stream, last_stream_version)
- 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 call
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def call(_name, _start, _finish, _id, payload)
Method ordered
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ordered(direction, stream, offset_entry_id = nil, stop_entry_id = nil, time_sort_by = nil)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(actual_klass, actual_metadata, actual_data, expected_metadata, expected_data)
Method each
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def each
return to_enum unless block_given?
offset_id = nil
0.step(total_limit - 1, batch_size) do |batch_offset|
- 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"