cequel/cequel

View on GitHub

Showing 23 of 473 total issues

Class RecordSet has 82 methods (exceeds 20 allowed). Consider refactoring.
Open

    class RecordSet < SimpleDelegator
      extend Util::Forwardable
      extend Cequel::Util::HashAccessors
      include Enumerable
      include BulkWrites
Severity: Major
Found in lib/cequel/record/record_set.rb - About 1 day to fix

    File record_set.rb has 455 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Cequel
      module Record
        #
        # This class represents a subset of records from a particular table. Record
        # sets encapsulate a CQL query, and are constructed using a chained builder
    Severity: Minor
    Found in lib/cequel/record/record_set.rb - About 6 hrs to fix

      Class DataSet has 48 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class DataSet
            include Enumerable
            extend Util::Forwardable
      
            # @return [Keyspace] keyspace that this data set's table resides in
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb - About 6 hrs to fix

        Method migrate has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

          def migrate
            watch_stack = ActiveSupport::Dependencies::WatchStack.new
        
            migration_table_names = Set[]
            project_root = defined?(Rails) ? Rails.root : Dir.pwd
        Severity: Minor
        Found in lib/cequel/record/tasks.rb - About 3 hrs 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

        Class Keyspace has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Keyspace
              extend Util::Forwardable
              include Logging
              include MonitorMixin
        
        
        Severity: Minor
        Found in lib/cequel/metal/keyspace.rb - About 2 hrs to fix

          File data_set.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'forwardable'
          
          module Cequel
            module Metal
              #
          Severity: Minor
          Found in lib/cequel/metal/data_set.rb - About 2 hrs to fix

            Class Table has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class Table
            
                  # @return [Symbol] the name of the table
                  attr_reader :name
            
            
            Severity: Minor
            Found in lib/cequel/schema/table.rb - About 2 hrs to fix

              File collection.rb has 252 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'delegate'
              
              module Cequel
                module Record
                  #
              Severity: Minor
              Found in lib/cequel/record/collection.rb - About 2 hrs to fix

                Method from_result_row has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                      def self.from_result_row(result_row)
                        if result_row
                          new.tap do |row|
                            result_row.each_pair do |name, value|
                              if name =~ /^(ttl|writetime)\((.+)\)$/
                Severity: Minor
                Found in lib/cequel/metal/row.rb - About 1 hr 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 migrate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def migrate
                    watch_stack = ActiveSupport::Dependencies::WatchStack.new
                
                    migration_table_names = Set[]
                    project_root = defined?(Rails) ? Rails.root : Dir.pwd
                Severity: Minor
                Found in lib/cequel/record/tasks.rb - About 1 hr to fix

                  Method create! has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def create!(options = {})
                          bare_connection =
                            Metal::Keyspace.new(keyspace.configuration.except(:keyspace))
                  
                          default_options = {
                  Severity: Minor
                  Found in lib/cequel/schema/keyspace.rb - About 1 hr to fix

                    Method write_attribute has a Cognitive Complexity of 9 (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/persistence.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 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

                    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 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 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

                    Severity
                    Category
                    Status
                    Source
                    Language