archan937/clickhouse

View on GitHub
lib/clickhouse/connection/query/result_row.rb

Summary

Maintainability
A
0 mins
Test Coverage

Use =~ in places where the MatchData returned by #match will not be used.
Open

              key.match(/^any\(([^\)]+)\)$/)

This cop identifies the use of Regexp#match or String#match, which returns #<MatchData>/nil. The return value of =~ is an integral index/nil and is more performant.

Example:

# bad
do_something if str.match(/regex/)
while regex.match('str')
  do_something
end

# good
method(str =~ /regex/)
return value unless regex =~ 'str'

Indent access modifiers like private.
Open

      private

Modifiers should be indented as deep as method definitions, or as deep as the class/module keyword, depending on configuration.

Example: EnforcedStyle: indent (default)

# bad
class Plumbus
private
  def smooth; end
end

# good
class Plumbus
  private
  def smooth; end
end

Example: EnforcedStyle: outdent

# bad
class Plumbus
  private
  def smooth; end
end

# good
class Plumbus
private
  def smooth; end
end

Missing top-level class documentation comment.
Open

      class ResultRow < Array

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Extra empty line detected at class body end.
Open


      end

This cops checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

Avoid the use of Perl-style backrefs.
Open

              $1 || key

This cop looks for uses of Perl-style regexp match backreferences like $1, $2, etc.

Example:

# bad
puts $1

# good
puts Regexp.last_match(1)

Extra empty line detected at class body beginning.
Open


        def initialize(values = [], keys = nil)

This cops checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

There are no issues that match your filters.

Category
Status