reactrb/reactive-record

View on GitHub

Showing 269 of 269 total issues

Ambiguous block operator. Parenthesize the method arguments if it's surely a block operator, or add a whitespace to the right of the & if it should be a binary AND.
Open

            elsif @ar_instance.instance_eval &block

This cop checks for ambiguous operators in the first argument of a method invocation without parentheses.

Example:

# bad

# The `*` is interpreted as a splat operator but it could possibly be
# a `*` method invocation (i.e. `do_something.*(some_array)`).
do_something *some_array

Example:

# good

# With parentheses, there's no ambiguity.
do_something(*some_array)

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

    def initialize(model, hash = {}, ar_instance = nil)

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

Literal false appeared as a condition.
Open

              if false and parent.new?

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

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

      def initialize(owner_class, macro, name, options = {})

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

Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition.
Open

        new_value = if association = @model.reflect_on_association(method)

This cop checks for assignments in the conditions of if/while/until.

Example:

# bad

if some_var = true
  do_something
end

Example:

# good

if some_var == true
  do_something
end

Avoid rescuing the Exception class. Perhaps you meant to rescue StandardError?
Open

      rescue Exception => e
        message = "Could not subclass #{@model_klass.model_name} as #{type}.  Perhaps #{type} class has not been required. Exception: #{e}"
        `console.error(#{message})`

This cop checks for rescue blocks targeting the Exception class.

Example:

# bad

begin
  do_something
rescue Exception
  handle_exception
end

Example:

# good

begin
  do_something
rescue ArgumentError
  handle_exception
end

Shadowing outer local variable - record.
Open

      record = @records[model].detect { |record| record.attributes[attribute] == value}

This cop looks for use of the same name as outer local variables for block arguments or block local variables. This is a mimic of the warning "shadowing outer local variable - foo" from ruby -cw.

Example:

# bad

def some_method
  foo = 1

  2.times do |foo| # shadowing outer `foo`
    do_something(foo)
  end
end

Example:

# good

def some_method
  foo = 1

  2.times do |bar|
    do_something(bar)
  end
end

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

    def scope(name, body)

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

TODO found
Open

                # TODO once reading schema.rb on client is implemented throw an error here
Severity
Category
Status
Source
Language