VAGAScom/basquiat

View on GitHub

Showing 73 of 73 total issues

Basquiat::Adapters::RabbitMq::Connection#initialize has unused parameter 'kwargs'
Open

        def initialize(args, **kwargs)

Unused Parameter refers to methods with parameters that are unused in scope of the method.

Having unused parameters in a method is code smell because leaving dead code in a method can never improve the method and it makes the code confusing to read.

Example

Given:

class Klass
  def unused_parameters(x,y,z)
    puts x,y # but not z
  end
end

Reek would emit the following warning:

[2]:Klass#unused_parameters has unused parameter 'z' (UnusedParameters)

Basquiat::Adapters::RabbitMq::Configuration#merge_user_options has unused parameter 'kwargs'
Open

        def merge_user_options(*user_opts, **kwargs)

Unused Parameter refers to methods with parameters that are unused in scope of the method.

Having unused parameters in a method is code smell because leaving dead code in a method can never improve the method and it makes the code confusing to read.

Example

Given:

class Klass
  def unused_parameters(x,y,z)
    puts x,y # but not z
  end
end

Reek would emit the following warning:

[2]:Klass#unused_parameters has unused parameter 'z' (UnusedParameters)

Don't use parentheses around a method call.
Open

        if (other_hash.is_a?(Array))

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

Unused method argument - kwargs. If it's necessary, use _ or _kwargs as an argument name to indicate that it won't be used.
Open

        def initialize(args, **kwargs)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Line is too long. [135/119]
Open

        # @option tls_options [Boolean] :verify_peer determines if TLS peer authentication (verification) is performed, true by default

Line is too long. [121/119]
Open

        # @option tls_options [Array<String>] :tls_ca_certificates array of string paths to CA certificates in PEM format

Redundant return detected.
Open

          return @failover.fetch(key.to_sym, default_value)

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

Use each_key instead of keys.each.
Open

        procs.keys.each { |key| session.bind_queue(key) }

This cop checks for uses of each_key and each_value Hash methods.

Note: If you have an array of two-element arrays, you can put parentheses around the block arguments to indicate that you're not working with a hash, and suppress RuboCop offenses.

Example:

# bad
hash.keys.each { |k| p k }
hash.values.each { |v| p v }
hash.each { |k, _v| p k }
hash.each { |_k, v| p v }

# good
hash.each_key { |k| p k }
hash.each_value { |v| p v }

Don't use parentheses around the condition of an if.
Open

        if (other_hash.is_a?(Array))

This cop checks for the presence of superfluous parentheses around the condition of if/unless/while/until.

Example:

# bad
x += 1 while (x < 10)
foo unless (bar || baz)

if (x > 10)
elsif (x < 3)
end

# good
x += 1 while x < 10
foo unless bar || baz

if x > 10
elsif x < 3
end

Add an empty line after magic comments.
Open

source 'https://rubygems.org'
Severity: Minor
Found in Gemfile 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

Unused method argument - kwargs. If it's necessary, use _ or _kwargs as an argument name to indicate that it won't be used.
Open

        def merge_user_options(*user_opts, **kwargs)

This cop checks for unused method arguments.

Example:

# bad

def some_method(used, unused, _unused_but_allowed)
  puts used
end

Example:

# good

def some_method(used, _unused, _unused_but_allowed)
  puts used
end

Line is too long. [128/119]
Open

      @yaml = YAML.safe_load(ERB.new(IO.readlines(path).join).result, aliases: true, permitted_classes: [Symbol]).symbolize_keys

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

        if (other_hash.is_a?(Array))

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?
Severity
Category
Status
Source
Language