lib/sequent/migrations/view_schema.rb
File view_schema.rb
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'parallel'
require 'postgresql_cursor'
require_relative 'errors'
require_relative '../support/database'
Class ViewSchema
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ViewSchema
# Corresponds with the index on aggregate_id column in the event_records table
#
# Since we replay in batches of the first 3 chars of the uuid we created an index on
# these 3 characters. Hence the name ;-)
Method replay!
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def replay!(
replay_persistor,
groups:,
projectors: plan.projectors,
minimum_xact_id_inclusive: nil,
Method migrate_online
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def migrate_online
ensure_valid_plan!
migrate_metadata_tables
return if Sequent.new_version == current_version
Method replay!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def replay!(
replay_persistor,
groups:,
projectors: plan.projectors,
minimum_xact_id_inclusive: nil,
- 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 replay_events
has 6 arguments (exceeds 4 allowed). Consider refactoring. Wontfix
Wontfix
aggregate_prefixes,
event_types,
minimum_xact_id_inclusive,
maximum_xact_id_exclusive,
replay_persistor,
Method event_stream
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def event_stream(aggregate_prefixes, event_types, minimum_xact_id_inclusive, maximum_xact_id_exclusive)
fail ArgumentError, 'aggregate_prefixes is mandatory' unless aggregate_prefixes.present?
event_stream = Sequent.configuration.event_record_class.where(event_type: event_types)
event_stream = event_stream.where(<<~SQL, aggregate_prefixes)
- 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"