cequel/cequel

View on GitHub
lib/cequel/metal/data_set.rb

Summary

Maintainability
C
1 day
Test Coverage

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

    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

      Line is too long. [100/80]
      Open

            # @note A bug (CASSANDRA-8733) exists in Cassandra versions 0.3.0-2.0.12 and 2.1.0-2.1.2 which
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      Use alias instead of alias_method in a class body.
      Open

            alias_method :incr, :increment
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

      Example: EnforcedStyle: prefer_alias (default)

      # bad
      alias_method :bar, :foo
      alias :bar :foo
      
      # good
      alias bar foo

      Example: EnforcedStyle: preferaliasmethod

      # bad
      alias :bar :foo
      alias bar foo
      
      # good
      alias_method :bar, :foo

      Align .append with .new on line 654.
      Open

                .append(limit_cql)
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the indentation of the method name part in method calls that span more than one line.

      Example: EnforcedStyle: aligned

      # bad
      while myvariable
      .b
        # do something
      end
      
      # good
      while myvariable
            .b
        # do something
      end
      
      # good
      Thing.a
           .b
           .c

      Example: EnforcedStyle: indented

      # good
      while myvariable
        .b
      
        # do something
      end

      Example: EnforcedStyle: indentedrelativeto_receiver

      # good
      while myvariable
              .a
              .b
      
        # do something
      end
      
      # good
      myvariable = Thing
                     .a
                     .b
                     .c

      Align .append with .new on line 654.
      Open

                .append(select_cql)
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the indentation of the method name part in method calls that span more than one line.

      Example: EnforcedStyle: aligned

      # bad
      while myvariable
      .b
        # do something
      end
      
      # good
      while myvariable
            .b
        # do something
      end
      
      # good
      Thing.a
           .b
           .c

      Example: EnforcedStyle: indented

      # good
      while myvariable
        .b
      
        # do something
      end

      Example: EnforcedStyle: indentedrelativeto_receiver

      # good
      while myvariable
              .a
              .b
      
        # do something
      end
      
      # good
      myvariable = Thing
                     .a
                     .b
                     .c

      Use alias instead of alias_method in a class body.
      Open

            alias_method :decr, :decrement
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

      Example: EnforcedStyle: prefer_alias (default)

      # bad
      alias_method :bar, :foo
      alias :bar :foo
      
      # good
      alias bar foo

      Example: EnforcedStyle: preferaliasmethod

      # bad
      alias :bar :foo
      alias bar foo
      
      # good
      alias_method :bar, :foo

      Align .concat with .row_specifications on line 513.
      Open

                  .concat(build_row_specifications(row_specification, bind_vars))
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the indentation of the method name part in method calls that span more than one line.

      Example: EnforcedStyle: aligned

      # bad
      while myvariable
      .b
        # do something
      end
      
      # good
      while myvariable
            .b
        # do something
      end
      
      # good
      Thing.a
           .b
           .c

      Example: EnforcedStyle: indented

      # good
      while myvariable
        .b
      
        # do something
      end

      Example: EnforcedStyle: indentedrelativeto_receiver

      # good
      while myvariable
              .a
              .b
      
        # do something
      end
      
      # good
      myvariable = Thing
                     .a
                     .b
                     .c

      Align .append with .new on line 654.
      Open

                .append(" FROM #{table_name}")
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the indentation of the method name part in method calls that span more than one line.

      Example: EnforcedStyle: aligned

      # bad
      while myvariable
      .b
        # do something
      end
      
      # good
      while myvariable
            .b
        # do something
      end
      
      # good
      Thing.a
           .b
           .c

      Example: EnforcedStyle: indented

      # good
      while myvariable
        .b
      
        # do something
      end

      Example: EnforcedStyle: indentedrelativeto_receiver

      # good
      while myvariable
              .a
              .b
      
        # do something
      end
      
      # good
      myvariable = Thing
                     .a
                     .b
                     .c

      Use alias instead of alias_method in a class body.
      Open

            alias_method :size, :count
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

      Example: EnforcedStyle: prefer_alias (default)

      # bad
      alias_method :bar, :foo
      alias :bar :foo
      
      # good
      alias bar foo

      Example: EnforcedStyle: preferaliasmethod

      # bad
      alias :bar :foo
      alias bar foo
      
      # good
      alias_method :bar, :foo

      Align .append with .new on line 654.
      Open

                .append(sort_order_cql)
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the indentation of the method name part in method calls that span more than one line.

      Example: EnforcedStyle: aligned

      # bad
      while myvariable
      .b
        # do something
      end
      
      # good
      while myvariable
            .b
        # do something
      end
      
      # good
      Thing.a
           .b
           .c

      Example: EnforcedStyle: indented

      # good
      while myvariable
        .b
      
        # do something
      end

      Example: EnforcedStyle: indentedrelativeto_receiver

      # good
      while myvariable
              .a
              .b
      
        # do something
      end
      
      # good
      myvariable = Thing
                     .a
                     .b
                     .c

      Use alias instead of alias_method in a class body.
      Open

            alias_method :select_timestamp, :select_writetime
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

      Example: EnforcedStyle: prefer_alias (default)

      # bad
      alias_method :bar, :foo
      alias :bar :foo
      
      # good
      alias bar foo

      Example: EnforcedStyle: preferaliasmethod

      # bad
      alias :bar :foo
      alias bar foo
      
      # good
      alias_method :bar, :foo

      Closing method call brace must be on the same line as the last argument when opening brace is on the same line as the first argument.
      Open

                                           )
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks that the closing brace in a method call is either on the same line as the last method argument, or a new line.

      When using the symmetrical (default) style:

      If a method call's opening brace is on the same line as the first argument of the call, then the closing brace should be on the same line as the last argument of the call.

      If an method call's opening brace is on the line above the first argument of the call, then the closing brace should be on the line below the last argument of the call.

      When using the new_line style:

      The closing brace of a multi-line method call must be on the line after the last argument of the call.

      When using the same_line style:

      The closing brace of a multi-line method call must be on the same line as the last argument of the call.

      Example:

      # symmetrical: bad
        # new_line: good
        # same_line: bad
        foo(a,
          b
        )
      
        # symmetrical: bad
        # new_line: bad
        # same_line: good
        foo(
          a,
          b)
      
        # symmetrical: good
        # new_line: bad
        # same_line: good
        foo(a,
          b)
      
        # symmetrical: good
        # new_line: good
        # same_line: bad
        foo(
          a,
          b
        )

      Align .join with sort_order on line 758.
      Open

                  .join(', ')
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the indentation of the method name part in method calls that span more than one line.

      Example: EnforcedStyle: aligned

      # bad
      while myvariable
      .b
        # do something
      end
      
      # good
      while myvariable
            .b
        # do something
      end
      
      # good
      Thing.a
           .b
           .c

      Example: EnforcedStyle: indented

      # good
      while myvariable
        .b
      
        # do something
      end

      Example: EnforcedStyle: indentedrelativeto_receiver

      # good
      while myvariable
              .a
              .b
      
        # do something
      end
      
      # good
      myvariable = Thing
                     .a
                     .b
                     .c

      Align .map with sort_order on line 758.
      Open

                  .map { |column, direction| "#{column} #{direction.to_s.upcase}" }
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the indentation of the method name part in method calls that span more than one line.

      Example: EnforcedStyle: aligned

      # bad
      while myvariable
      .b
        # do something
      end
      
      # good
      while myvariable
            .b
        # do something
      end
      
      # good
      Thing.a
           .b
           .c

      Example: EnforcedStyle: indented

      # good
      while myvariable
        .b
      
        # do something
      end

      Example: EnforcedStyle: indentedrelativeto_receiver

      # good
      while myvariable
              .a
              .b
      
        # do something
      end
      
      # good
      myvariable = Thing
                     .a
                     .b
                     .c

      Use alias instead of alias_method in a class body.
      Open

            alias_method :length, :count
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

      Example: EnforcedStyle: prefer_alias (default)

      # bad
      alias_method :bar, :foo
      alias :bar :foo
      
      # good
      alias bar foo

      Example: EnforcedStyle: preferaliasmethod

      # bad
      alias :bar :foo
      alias bar foo
      
      # good
      alias_method :bar, :foo

      Do not use parallel assignment.
      Open

              @select_columns, @ttl_columns, @writetime_columns, @row_specifications,
                @sort_order = [], [], [], [], {}
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      Checks for simple usages of parallel assignment. This will only complain when the number of variables being assigned matched the number of assigning variables.

      Example:

      # bad
      a, b, c = 1, 2, 3
      a, b, c = [1, 2, 3]
      
      # good
      one, two = *foo
      a, b = foo()
      a, b = b, a
      
      a = 1
      b = 2
      c = 3

      Provide an exception class and message as arguments to raise.
      Open

              raise Cequel::Record::DangerousQueryError.new
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the args passed to fail and raise. For exploded style (default), it recommends passing the exception class and message to raise, rather than construct an instance of the error. It will still allow passing just a message, or the construction of an error with more than one argument.

      The exploded style works identically, but with the addition that it will also suggest constructing error objects when the exception is passed multiple arguments.

      Example: EnforcedStyle: exploded (default)

      # bad
      raise StandardError.new("message")
      
      # good
      raise StandardError, "message"
      fail "message"
      raise MyCustomError.new(arg1, arg2, arg3)
      raise MyKwArgError.new(key1: val1, key2: val2)

      Example: EnforcedStyle: compact

      # bad
      raise StandardError, "message"
      raise RuntimeError, arg1, arg2, arg3
      
      # good
      raise StandardError.new("message")
      raise MyCustomError.new(arg1, arg2, arg3)
      fail "message"

      Do not use parallel assignment.
      Open

                cql_fragments, bind_vars = [], []
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      Checks for simple usages of parallel assignment. This will only complain when the number of variables being assigned matched the number of assigning variables.

      Example:

      # bad
      a, b, c = 1, 2, 3
      a, b, c = [1, 2, 3]
      
      # good
      one, two = *foo
      a, b = foo()
      a, b = b, a
      
      a = 1
      b = 2
      c = 3

      Align .append with .new on line 654.
      Open

                .append(*row_specifications_cql)
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the indentation of the method name part in method calls that span more than one line.

      Example: EnforcedStyle: aligned

      # bad
      while myvariable
      .b
        # do something
      end
      
      # good
      while myvariable
            .b
        # do something
      end
      
      # good
      Thing.a
           .b
           .c

      Example: EnforcedStyle: indented

      # good
      while myvariable
        .b
      
        # do something
      end

      Example: EnforcedStyle: indentedrelativeto_receiver

      # good
      while myvariable
              .a
              .b
      
        # do something
      end
      
      # good
      myvariable = Thing
                     .a
                     .b
                     .c

      Align .replace with .row_specifications on line 526.
      Open

                  .replace(build_row_specifications(row_specification, bind_vars))
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the indentation of the method name part in method calls that span more than one line.

      Example: EnforcedStyle: aligned

      # bad
      while myvariable
      .b
        # do something
      end
      
      # good
      while myvariable
            .b
        # do something
      end
      
      # good
      Thing.a
           .b
           .c

      Example: EnforcedStyle: indented

      # good
      while myvariable
        .b
      
        # do something
      end

      Example: EnforcedStyle: indentedrelativeto_receiver

      # good
      while myvariable
              .a
              .b
      
        # do something
      end
      
      # good
      myvariable = Thing
                     .a
                     .b
                     .c

      Align .append with .new on line 654.
      Open

                .append(allow_filtering_cql)
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      This cop checks the indentation of the method name part in method calls that span more than one line.

      Example: EnforcedStyle: aligned

      # bad
      while myvariable
      .b
        # do something
      end
      
      # good
      while myvariable
            .b
        # do something
      end
      
      # good
      Thing.a
           .b
           .c

      Example: EnforcedStyle: indented

      # good
      while myvariable
        .b
      
        # do something
      end

      Example: EnforcedStyle: indentedrelativeto_receiver

      # good
      while myvariable
              .a
              .b
      
        # do something
      end
      
      # good
      myvariable = Thing
                     .a
                     .b
                     .c

      Line is too long. [105/80]
      Open

            attr_writer :row_limit, :query_consistency, :query_page_size, :query_paging_state, :allow_filtering
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      Add an empty line after magic comments.
      Open

      require 'forwardable'
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      Checks for a newline after the final magic comment.

      Example:

      # good
      # frozen_string_literal: true
      
      # Some documentation for Person
      class Person
        # Some code
      end
      
      # bad
      # frozen_string_literal: true
      # Some documentation for Person
      class Person
        # Some code
      end

      Line is too long. [82/80]
      Open

            # @return [Statement] CQL `SELECT` statement encoding this data set's scope.
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      Do not use parallel assignment.
      Open

              @table_name, @keyspace = table_name, keyspace
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      Checks for simple usages of parallel assignment. This will only complain when the number of variables being assigned matched the number of assigning variables.

      Example:

      # bad
      a, b, c = 1, 2, 3
      a, b, c = [1, 2, 3]
      
      # good
      one, two = *foo
      a, b = foo()
      a, b = b, a
      
      a = 1
      b = 2
      c = 3

      Unnecessary utf-8 encoding comment.
      Open

      # -*- encoding : utf-8 -*-
      Severity: Minor
      Found in lib/cequel/metal/data_set.rb by rubocop

      There are no issues that match your filters.

      Category
      Status