cequel/cequel

View on GitHub
lib/cequel/schema/table.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

    Add an empty line after magic comments.
    Open

    require 'stringio'
    Severity: Minor
    Found in lib/cequel/schema/table.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

    Avoid single-line method definitions.
    Open

              def name; nil; end
    Severity: Minor
    Found in lib/cequel/schema/table.rb by rubocop

    This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

    Example:

    # bad
    def some_method; body end
    def link_to(url); {:name => url}; end
    def @table.columns; super; end
    
    # good
    def no_op; end
    def self.resource_class=(klass); end
    def @table.columns; end

    Do not use parallel assignment.
    Open

            @partition_key_columns, @clustering_columns, @data_columns = [], [], []
    Severity: Minor
    Found in lib/cequel/schema/table.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

    Extra empty line detected at class body beginning.
    Open

    
          # @return [Symbol] the name of the table
    Severity: Minor
    Found in lib/cequel/schema/table.rb by rubocop

    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

    Use empty lines between method definitions.
    Open

              def name; nil; end
    Severity: Minor
    Found in lib/cequel/schema/table.rb by rubocop

    This cop checks whether method definitions are separated by one empty line.

    NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

    AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

    Example:

    # bad
    def a
    end
    def b
    end

    Example:

    # good
    def a
    end
    
    def b
    end

    Do not use parallel assignment.
    Open

            @columns, @columns_by_name = [], {}
    Severity: Minor
    Found in lib/cequel/schema/table.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

    Avoid single-line method definitions.
    Open

              def value; nil; end
    Severity: Minor
    Found in lib/cequel/schema/table.rb by rubocop

    This cop checks for single-line method definitions that contain a body. It will accept single-line methods with no body.

    Example:

    # bad
    def some_method; body end
    def link_to(url); {:name => url}; end
    def @table.columns; super; end
    
    # good
    def no_op; end
    def self.resource_class=(klass); end
    def @table.columns; end

    Use Hash#key? instead of Hash#has_key?.
    Open

            columns_by_name.has_key?(name.to_sym)
    Severity: Minor
    Found in lib/cequel/schema/table.rb by rubocop

    This cop (by default) checks for uses of methods Hash#haskey? and Hash#hasvalue? where it enforces Hash#key? and Hash#value? It is configurable to enforce the inverse, using verbose method names also.

    Example: EnforcedStyle: short (default)

    # bad Hash#haskey? Hash#hasvalue?

    # good Hash#key? Hash#value?

    Example: EnforcedStyle: verbose

    # bad Hash#key? Hash#value?

    # good Hash#haskey? Hash#hasvalue?

    Replace class var @@null_table_property with a class instance var.
    Open

            @@null_table_property ||= Class.new do
    Severity: Minor
    Found in lib/cequel/schema/table.rb by rubocop

    This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

    Unnecessary utf-8 encoding comment.
    Open

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

    There are no issues that match your filters.

    Category
    Status