cequel/cequel

View on GitHub

Showing 473 of 473 total issues

Line is too long. [96/80]
Open

            raise NotImplementedError, "#execute_stmt must be implemented in #{self.class.name}"

Avoid the use of the case equality operator ===.
Open

                           Cassandra::MaterializedView === table_data)
Severity: Minor
Found in lib/cequel/schema/table_reader.rb by rubocop

This cop checks for uses of the case equality operator(===).

Example:

# bad
Array === something
(1..100) === 7
/something/ === some_string

# good
something.is_a?(Array)
(1..100).include?(7)
some_string =~ /something/

Redundant else-clause.
Open

        else
Severity: Minor
Found in lib/cequel/schema/table_reader.rb by rubocop

Checks for empty else-clauses, possibly including comments and/or an explicit nil depending on the EnforcedStyle.

Example: EnforcedStyle: empty

# warn only on empty else

# bad
if condition
  statement
else
end

# good
if condition
  statement
else
  nil
end

# good
if condition
  statement
else
  statement
end

# good
if condition
  statement
end

Example: EnforcedStyle: nil

# warn on else with nil in it

# bad
if condition
  statement
else
  nil
end

# good
if condition
  statement
else
end

# good
if condition
  statement
else
  statement
end

# good
if condition
  statement
end

Example: EnforcedStyle: both (default)

# warn on empty else and else with nil in it

# bad
if condition
  statement
else
  nil
end

# bad
if condition
  statement
else
end

# good
if condition
  statement
else
  statement
end

# good
if condition
  statement
end

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

        mod.module_eval <<-METH
Severity: Minor
Found in lib/cequel/instrumentation.rb by rubocop

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

Use the lambda method for multiline lambdas.
Open

        @@prop_extractors << ->(table, table_data) {
Severity: Minor
Found in lib/cequel/schema/table_reader.rb by rubocop

This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

Example: EnforcedStyle: linecountdependent (default)

# bad
f = lambda { |x| x }
f = ->(x) do
      x
    end

# good
f = ->(x) { x }
f = lambda do |x|
      x
    end

Example: EnforcedStyle: lambda

# bad
f = ->(x) { x }
f = ->(x) do
      x
    end

# good
f = lambda { |x| x }
f = lambda do |x|
      x
    end

Example: EnforcedStyle: literal

# bad
f = lambda { |x| x }
f = lambda do |x|
      x
    end

# good
f = ->(x) { x }
f = ->(x) do
      x
    end

Line is too long. [84/80]
Open

      # @return [Cassandra::Statements::Prepared] prepared version of this statement
Severity: Minor
Found in lib/cequel/metal/statement.rb by rubocop

Add an empty line after magic comments.
Open

module Cequel
Severity: Minor
Found in lib/cequel/schema/column.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

Redundant curly braces around a hash parameter.
Open

        execute_with_options(Statement.new(statement, bind_vars), { consistency: default_consistency })
Severity: Minor
Found in lib/cequel/metal/keyspace.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

Space between { and | missing.
Open

        patch.statements.each{|stmt| keyspace.execute(stmt) }
Severity: Minor
Found in lib/cequel/schema/keyspace.rb by rubocop

Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

Example: EnforcedStyle: space (default)

# The `space` style enforces that block braces have
# surrounding space.

# bad
some_array.each {puts e}

# good
some_array.each { puts e }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that block braces don't
# have surrounding space.

# bad
some_array.each { puts e }

# good
some_array.each {puts e}

Example: EnforcedStyleForEmptyBraces: no_space (default)

# The `no_space` EnforcedStyleForEmptyBraces style enforces that
# block braces don't have a space in between when empty.

# bad
some_array.each {   }
some_array.each {  }
some_array.each { }

# good
some_array.each {}

Example: EnforcedStyleForEmptyBraces: space

# The `space` EnforcedStyleForEmptyBraces style enforces that
# block braces have at least a spece in between when empty.

# bad
some_array.each {}

# good
some_array.each { }
some_array.each {  }
some_array.each {   }

Example: SpaceBeforeBlockParameters: true (default)

# The SpaceBeforeBlockParameters style set to `true` enforces that
# there is a space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each {|n| n * 2 }

# good
[1, 2, 3].each { |n| n * 2 }

Example: SpaceBeforeBlockParameters: true

# The SpaceBeforeBlockParameters style set to `false` enforces that
# there is no space between `{` and `|`. Overrides `EnforcedStyle`
# if there is a conflict.

# bad
[1, 2, 3].each { |n| n * 2 }

# good
[1, 2, 3].each {|n| n * 2 }

Add an empty line after magic comments.
Open

module Cequel
Severity: Minor
Found in lib/cequel/metal/request_logger.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

Align .map with .properties on line 88.
Open

          .map { |_, property| property.to_cql }
Severity: Minor
Found in lib/cequel/schema/table_writer.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

Add an empty line after magic comments.
Open

module Cequel

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

Do not use parallel assignment.
Open

          @old_name, @new_name = old_column.name, new_column.name
Severity: Minor
Found in lib/cequel/schema/patch.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 .map with added_columns on line 50.
Open

            .map { |new_c| Patch::AddColumn.new(table_b, new_c) } +
Severity: Minor
Found in lib/cequel/schema/table_differ.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 added_indexes on line 52.
Open

            .map { |col_with_new_idx| Patch::AddIndex.new(table_b, col_with_new_idx) } +
Severity: Minor
Found in lib/cequel/schema/table_differ.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. [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

Space missing to the left of {.
Open

          .reject{|c| table_b.column(c.name).indexed? }
Severity: Minor
Found in lib/cequel/schema/table_differ.rb by rubocop

Checks that block braces have or don't have a space before the opening brace depending on configuration.

Example:

# bad
foo.map{ |a|
  a.bar.to_s
}

# good
foo.map { |a|
  a.bar.to_s
}

Unnecessary utf-8 encoding comment.
Open

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

Use || instead of or.
Open

        return false if key_a.blank? or key_b.blank?
Severity: Minor
Found in lib/cequel/schema/table_differ.rb by rubocop

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

Add an empty line after magic comments.
Open

module Cequel

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
Severity
Category
Status
Source
Language