zilverline/sequent

View on GitHub

Showing 34 of 47 total issues

Method start_offline! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def self.start_offline!(new_version)
        current_migration = find_by(version: new_version)
        fail MigrationNotStarted if current_migration.blank?

        current_migration.with_lock('FOR UPDATE NOWAIT') do
Severity: Minor
Found in lib/sequent/migrations/versions.rb - About 55 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 parse_attrs_to_correct_types has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def parse_attrs_to_correct_types
          the_copy = dup
          the_copy.class.types.each do |name, type|
            raw_value = the_copy.send(name.to_s)
            next if raw_value.nil?
Severity: Minor
Found in lib/sequent/core/helpers/type_conversion_support.rb - About 55 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 load_aggregates has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def load_aggregates(aggregate_ids, clazz = nil)
        fail ArgumentError, 'aggregate_ids is required' unless aggregate_ids
        return [] if aggregate_ids.empty?

        unique_ids = aggregate_ids.uniq
Severity: Minor
Found in lib/sequent/core/aggregate_repository.rb - About 55 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 autoregister! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def autoregister!
      return unless enable_autoregistration

      # Only autoregister the AggregateSnapshotter if the autoregistration is enabled
      Sequent::Core::AggregateSnapshotter.skip_autoregister = false
Severity: Minor
Found in lib/sequent/configuration.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 replay! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def replay!(
        replay_persistor,
        groups:,
        projectors: plan.projectors,
        minimum_xact_id_inclusive: nil,
Severity: Minor
Found in lib/sequent/migrations/view_schema.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 attrs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

          def attrs(args)
            validate_attrs!(args)

            @types.merge!(args)
            associations = []
Severity: Minor
Found in lib/sequent/core/helpers/attribute_support.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 deserialize_from_json has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.deserialize_from_json(value)
    value.blank? ? nil : Time.iso8601(value.dup)
  rescue ArgumentError => e
    return Time.parse(value.dup) if e.message =~ /invalid xmlschema format/ # ruby >= 3
    return Time.parse(value.dup) if e.message =~ /invalid date:/ # ruby 2.7
Severity: Minor
Found in lib/sequent/core/ext/ext.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 find_records has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def find_records(record_class, where_clause)
          where_clause = where_clause.symbolize_keys

          indexed_columns = @record_index[record_class].indexed_columns
          indexed_fields, non_indexed_fields = where_clause.partition { |field, _| indexed_columns.include? field }
Severity: Minor
Found in lib/sequent/core/persistors/replay_optimized_postgres_persistor.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

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

        def update_record(record_class, event, where_clause = {aggregate_id: event.aggregate_id}, options = {})
          record = record_class.unscoped.where(where_clause).first
          unless record
            fail(<<~EOS)
              Record of class #{record_class} with where clause #{where_clause} not found while handling event #{event}
Severity: Minor
Found in lib/sequent/core/persistors/active_record_persistor.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

Method create_sequent_schema_if_not_exists has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def create_sequent_schema_if_not_exists(env:, fail_if_exists: true)
          fail ArgumentError, 'env is required' if env.blank?

          db_config = Sequent::Support::Database.read_config(env)

Severity: Minor
Found in lib/sequent/migrations/sequent_schema.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

Method set_table_names_to_new_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def set_table_names_to_new_version(plan)
        plan.replay_tables.each do |migration|
          table = migration.record_class
          next if table.table_name.end_with?("_#{migration.version}")

Severity: Minor
Found in lib/sequent/migrations/executor.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

Method validation_errors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def validation_errors(prefix = nil)
          result = errors.to_hash
          self.class.types.each do |field|
            value = instance_variable_get("@#{field[0]}")
            if value.respond_to? :validation_errors
Severity: Minor
Found in lib/sequent/core/helpers/attribute_support.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

Method event_stream has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
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)
Severity: Minor
Found in lib/sequent/migrations/view_schema.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

Method from_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.from_params(value)
    return value if value.is_a?(Date)

    value.blank? ? nil : Date.iso8601(value.dup)
  rescue ArgumentError
Severity: Minor
Found in lib/sequent/core/ext/ext.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

Severity
Category
Status
Source
Language