etehtsea/oxblood

View on GitHub
lib/oxblood/rsocket.rb

Summary

Maintainability
A
0 mins
Test Coverage

Extra blank line detected.
Open


    def fail_with_timeout!
Severity: Minor
Found in lib/oxblood/rsocket.rb by rubocop

This cops checks for two or more consecutive blank lines.

Example:

# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method

# good
some_method
# one empty line
some_method

Use || instead of or.
Open

        socket.wait_readable(timeout) or fail_with_timeout!
Severity: Minor
Found in lib/oxblood/rsocket.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

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

      !!@socket
Severity: Minor
Found in lib/oxblood/rsocket.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.

Use Kernel#loop for infinite loops.
Open

      end while true
Severity: Minor
Found in lib/oxblood/rsocket.rb by rubocop

Use Kernel#loop for infinite loops.

Example:

# bad
while true
  work
end

# good
loop do
  work
end

Line is too long. [84/80]
Open

    # @option opts [String] :host ('localhost') Hostname or IP address to connect to
Severity: Minor
Found in lib/oxblood/rsocket.rb by rubocop

Literal true appeared as a condition.
Open

      end while true
Severity: Minor
Found in lib/oxblood/rsocket.rb by rubocop

This cop checks for literals used as the conditions or as operands in and/or expressions serving as the conditions of if/while/until.

Example:

# bad

if 20
  do_something
end

Example:

# bad

if some_var && true
  do_something
end

Example:

# good

if some_var && some_condition
  do_something
end

Do not use semicolons to terminate expressions.
Open

      ;
Severity: Minor
Found in lib/oxblood/rsocket.rb by rubocop

This cop checks for multiple expressions placed on the same line. It also checks for lines terminated with a semicolon.

Example:

# bad
foo = 1; bar = 2;
baz = 3;

# good
foo = 1
bar = 2
baz = 3

Do not suppress exceptions.
Open

    rescue IOError
Severity: Minor
Found in lib/oxblood/rsocket.rb by rubocop

This cop checks for rescue blocks with no body.

Example:

# bad

def some_method
  do_something
rescue
  # do nothing
end

Example:

# bad

begin
  do_something
rescue
  # do nothing
end

Example:

# good

def some_method
  do_something
rescue
  handle_exception
end

Example:

# good

begin
  do_something
rescue
  handle_exception
end

Line is too long. [84/80]
Open

                       Gem::Version.new(JRUBY_VERSION) < Gem::Version.new('9.1.6.0')
Severity: Minor
Found in lib/oxblood/rsocket.rb by rubocop

Use || instead of or.
Open

          socket.wait_writable(timeout) or fail_with_timeout!
Severity: Minor
Found in lib/oxblood/rsocket.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

Use empty lines between method definitions.
Open

    def fail_with_timeout!
Severity: Minor
Found in lib/oxblood/rsocket.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

Use string literal '' instead of String.new.
Open

      @buffer = String.new.encode!('ASCII-8BIT')
Severity: Minor
Found in lib/oxblood/rsocket.rb by rubocop

This cop checks for the use of a method, the result of which would be a literal, like an empty array, hash or string.

Example:

# bad
a = Array.new
h = Hash.new
s = String.new

# good
a = []
h = {}
s = ''

There are no issues that match your filters.

Category
Status