inertia186/radiator

View on GitHub
lib/radiator/ssc/contracts.rb

Summary

Maintainability
A
0 mins
Test Coverage

Method has too many lines. [13/10]
Open

      def healthy?
        begin
          request(method: 'find', params: {
            contract: 'tokens',
            table: 'transfers',
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Line is too long. [90/80]
Open

      # @return the object that matches the query from the table of the specified contract
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Trailing whitespace detected.
Open

          
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Line is too long. [123/80]
Open

      # @option options [String] :url Specify the full node end-point.  Default: https://api.steem-engine.net/rpc/contracts
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Line is too long. [117/80]
Open

      # @option options [::Hash] indexes default: empty, an index is an object { index: string, descending: boolean }
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Redundant begin block detected.
Open

        begin
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

This cop checks for redundant begin blocks.

Currently it checks for code like this:

Example:

def redundant
  begin
    ala
    bala
  rescue StandardError => e
    something
  end
end

def preferred
  ala
  bala
rescue StandardError => e
  something
end

Trailing whitespace detected.
Open

      
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Space inside { missing.
Open

        request(method: 'getContract', params: {name: name})
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Avoid the use of double negation (!!).
Open

          !!shutdown
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

This cop checks for uses of double negation (!!) to convert something to a boolean value. As this is both cryptic and usually redundant, it should be avoided.

Example:

# bad
!!something

# good
!something.nil?

Please, note that when something is a boolean value !!something and !something.nil? are not the same thing. As you're unlikely to write code that can accept values of any type this is rarely a problem in practice.

Space inside } missing.
Open

        request(method: 'getContract', params: {name: name})
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Line is too long. [94/80]
Open

      # @return array of objects that match the query from the table of the specified contract
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Indent the right brace the same as the first position after the preceding left parenthesis.
Open

          }, skip_health_check: true).nil?
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

This cops checks the indentation of the first key in a hash literal where the opening brace and the first key are on separate lines. The other keys' indentations are handled by the AlignHash cop.

By default, Hash literals that are arguments in a method call with parentheses, and where the opening curly brace of the hash is on the same line as the opening parenthesis of the method call, shall have their first key indented one step (two spaces) more than the position inside the opening parenthesis.

Other hash literals shall have their first key indented one step more than the start of the line where the opening curly brace is.

This default style is called 'specialinsideparentheses'. Alternative styles are 'consistent' and 'align_braces'. Here are examples:

Example: EnforcedStyle: specialinsideparentheses (default)

# The `special_inside_parentheses` style enforces that the first key
# in a hash literal where the opening brace and the first key are on
# separate lines is indented one step (two spaces) more than the
# position inside the opening parentheses.

# bad
hash = {
  key: :value
}
and_in_a_method_call({
  no: :difference
                     })

# good
special_inside_parentheses
hash = {
  key: :value
}
but_in_a_method_call({
                       its_like: :this
                     })

Example: EnforcedStyle: consistent

# The `consistent` style enforces that the first key in a hash
# literal where the opening brace and the first key are on
# seprate lines is indented the same as a hash literal which is not
# defined inside a method call.

# bad
hash = {
  key: :value
}
but_in_a_method_call({
                       its_like: :this
                      })

# good
hash = {
  key: :value
}
and_in_a_method_call({
  no: :difference
})

Example: EnforcedStyle: align_braces

# The `align_brackets` style enforces that the opening and closing
# braces are indented to the same position.

# bad
and_now_for_something = {
                          completely: :different
}

# good
and_now_for_something = {
                          completely: :different
                        }

Trailing whitespace detected.
Open

      
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Keep a blank line before and after protected.
Open

    protected
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Access modifiers should be surrounded by blank lines.

Example:

# bad
class Foo
  def bar; end
  private
  def baz; end
end

# good
class Foo
  def bar; end

  private

  def baz; end
end

Trailing whitespace detected.
Open

    # 
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Avoid rescuing without specifying an error class.
Open

        rescue => e
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

Example: EnforcedStyle: implicit

# `implicit` will enforce using `rescue` instead of
# `rescue StandardError`.

# bad
begin
  foo
rescue StandardError
  bar
end

# good
begin
  foo
rescue
  bar
end

# good
begin
  foo
rescue OtherError
  bar
end

# good
begin
  foo
rescue StandardError, SecurityError
  bar
end

Example: EnforcedStyle: explicit (default)

# `explicit` will enforce using `rescue StandardError`
# instead of `rescue`.

# bad
begin
  foo
rescue
  bar
end

# good
begin
  foo
rescue StandardError
  bar
end

# good
begin
  foo
rescue OtherError
  bar
end

# good
begin
  foo
rescue StandardError, SecurityError
  bar
end

Indent access modifiers like protected.
Open

    protected
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

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

Trailing whitespace detected.
Open

      
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

Use 2 spaces for indentation in a hash, relative to the first position after the preceding left parenthesis.
Open

            contract: 'tokens',
Severity: Minor
Found in lib/radiator/ssc/contracts.rb by rubocop

This cops checks the indentation of the first key in a hash literal where the opening brace and the first key are on separate lines. The other keys' indentations are handled by the AlignHash cop.

By default, Hash literals that are arguments in a method call with parentheses, and where the opening curly brace of the hash is on the same line as the opening parenthesis of the method call, shall have their first key indented one step (two spaces) more than the position inside the opening parenthesis.

Other hash literals shall have their first key indented one step more than the start of the line where the opening curly brace is.

This default style is called 'specialinsideparentheses'. Alternative styles are 'consistent' and 'align_braces'. Here are examples:

Example: EnforcedStyle: specialinsideparentheses (default)

# The `special_inside_parentheses` style enforces that the first key
# in a hash literal where the opening brace and the first key are on
# separate lines is indented one step (two spaces) more than the
# position inside the opening parentheses.

# bad
hash = {
  key: :value
}
and_in_a_method_call({
  no: :difference
                     })

# good
special_inside_parentheses
hash = {
  key: :value
}
but_in_a_method_call({
                       its_like: :this
                     })

Example: EnforcedStyle: consistent

# The `consistent` style enforces that the first key in a hash
# literal where the opening brace and the first key are on
# seprate lines is indented the same as a hash literal which is not
# defined inside a method call.

# bad
hash = {
  key: :value
}
but_in_a_method_call({
                       its_like: :this
                      })

# good
hash = {
  key: :value
}
and_in_a_method_call({
  no: :difference
})

Example: EnforcedStyle: align_braces

# The `align_brackets` style enforces that the opening and closing
# braces are indented to the same position.

# bad
and_now_for_something = {
                          completely: :different
}

# good
and_now_for_something = {
                          completely: :different
                        }

There are no issues that match your filters.

Category
Status