cequel/cequel

View on GitHub

Showing 32 of 473 total issues

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

      def sync_schema
        record_classes.each do |record_class|
          begin
            record_class.synchronize_schema
            unless options[:quiet]
Severity: Minor
Found in lib/cequel/spec_support/preparation.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 client_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def client_options
        {hosts: hosts, port: port}.tap do |options|
          options.merge!(credentials) if credentials
          options.merge!(ssl_config) if ssl_config
          options.merge!(compression: client_compression) if client_compression
Severity: Minor
Found in lib/cequel/metal/keyspace.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 []= has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def []=(*args)
        if args[0].is_a?(Integer) && args.count == 2
          # single element set/replace
          elem = cast_element(args[1])

Severity: Minor
Found in lib/cequel/record/collection.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

Block has too many lines. [29/25]
Open

      define_method :execute_with_options_with_newrelic do |statement, options|

        operation = nil
        statement_txt = nil
        statement_words = nil

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

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

        def key(name, type, options = {})
          def_accessors(name)
          if options.fetch(:auto, false)
            unless Type[type].is_a?(Cequel::Type::Uuid)
              fail ArgumentError, ":auto option only valid for UUID columns"
Severity: Minor
Found in lib/cequel/record/properties.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 cast has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def cast(value)
        if value.is_a? Cassandra::Uuid then value
        elsif defined?(SimpleUUID::UUID) && value.is_a?(SimpleUUID::UUID)
          Cassandra::Uuid.new(value.to_i)
        elsif value.is_a?(::Integer) || value.is_a?(::String)
Severity: Minor
Found in lib/cequel/type.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 execute_stmt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def execute_stmt(keyspace)
            retries_remaining = max_retries
            begin
              yield
            rescue Cassandra::Errors::NoHostsAvailable,
Severity: Minor
Found in lib/cequel/metal/policy/cassandra_error.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 clear_active_connections! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def clear_active_connections!
        synchronize do
          if defined? @client
            remove_instance_variable(:@client)
          end
Severity: Minor
Found in lib/cequel/metal/keyspace.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 write_attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def write_attribute(name, value)
        column = self.class.reflect_on_column(name)
        fail UnknownAttributeError, "unknown attribute: #{name}" unless column
        value = column.cast(value) unless value.nil?

Severity: Minor
Found in lib/cequel/record/dirty.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 find_rows_in_batches has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def find_rows_in_batches(options = {}, &block)
        return find_rows_in_single_batch(options, &block) if row_limit
        options.assert_valid_keys(:batch_size)
        batch_size = options.fetch(:batch_size, 1000)
        batch_record_set = base_record_set = limit(batch_size)
Severity: Minor
Found in lib/cequel/record/record_set.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 find_rows_in_single_batch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def find_rows_in_single_batch(options = {})
        if options.key?(:batch_size)
          fail ArgumentError,
               "Can't pass :batch_size argument with a limit in the scope"
        else
Severity: Minor
Found in lib/cequel/record/record_set.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 save has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def save(options = {})
        super.tap do |success|
          if success
            if self.respond_to?(:changes_applied)
              changes_applied
Severity: Minor
Found in lib/cequel/record/dirty.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