reactrb/reactrb

View on GitHub

Showing 108 of 108 total issues

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

  def self.render(element, container)
Severity: Minor
Found in lib/react/top_level.rb by rubocop

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 #{native_inst}._getOpalInstance !== undefined appeared as a condition.
Open

            if `#{native_inst}._getOpalInstance !== undefined`
Severity: Minor
Found in lib/react/ref_callback.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

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

      def self.render_into_document(element, options = {})
Severity: Minor
Found in lib/react/test/utils.rb by rubocop

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 typeof ReactDOM === 'undefined' appeared as a condition.
Open

    if !(`typeof ReactDOM === 'undefined'`)
Severity: Minor
Found in lib/react/top_level.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

Unused method argument - name. If it's necessary, use _ or _name as an argument name to indicate that it won't be used. You can also write as html_attr?(*) if you want the method to accept any arguments but don't care about them.
Open

  def self.html_attr?(name)
Severity: Minor
Found in lib/react/top_level.rb by rubocop

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 #{component} === undefined appeared as a condition.
Open

      raise "#{name} is not defined" if `#{component} === undefined`
Severity: Minor
Found in lib/react/api.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

Literal typeof ReactDOM === 'undefined' appeared as a condition.
Open

    if !(`typeof ReactDOM === 'undefined'`)
Severity: Minor
Found in lib/react/top_level.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

Literal defaults===null appeared as a condition.
Open

    if (`defaults===null`)
Severity: Minor
Found in lib/react/hash.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

Literal #{native}._getOpalInstance !== undefined appeared as a condition.
Open

    if `#{native}._getOpalInstance !== undefined`
Severity: Minor
Found in lib/react/top_level_render.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

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

      rescue Exception => e
        self.class.process_exception(e, self)
Severity: Minor
Found in lib/react/component.rb by rubocop

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

Literal typeof #{properties} === 'undefined' appeared as a condition.
Open

      @properties = (`typeof #{properties} === 'undefined'` ? nil : properties) || {}
Severity: Minor
Found in lib/react/element.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

Literal typeof React.renderToString === 'undefined' appeared as a condition.
Open

      elsif !(`typeof React.renderToString === 'undefined'`)
Severity: Minor
Found in lib/react/server.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

Literal typeof React.findDOMNode === 'undefined' appeared as a condition.
Open

        elsif !(`typeof React.findDOMNode === 'undefined'`)
Severity: Minor
Found in lib/react/component/api.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

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

      return unless klass = rules[prop_name][:type]
Severity: Minor
Found in lib/react/validator.rb by rubocop

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

Shadowing outer local variable - element.
Open

              @buffer.last.to_s.span.tap { |element| element.waiting_on_resources = saved_waiting_on_resources }
Severity: Minor
Found in lib/react/rendering_context.rb by rubocop

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

Literal React.findDOMNode !== undefined && #{native_inst}.nodeType === undefined appeared as a condition.
Open

            elsif `React.findDOMNode !== undefined && #{native_inst}.nodeType === undefined`
Severity: Minor
Found in lib/react/ref_callback.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

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

    def []=(state, new_value)
Severity: Minor
Found in lib/react/state_wrapper.rb by rubocop

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 %x around command string.
Open

    `#{self}.replace(/(^|_)([^_]+)/g, function(match, pre, word, index) {
      var capitalize = true;
      return capitalize ? word.substr(0,1).toUpperCase()+word.substr(1) : word;
    })`
Severity: Minor
Found in lib/react/ext/string.rb by rubocop

This cop enforces using `` or %x around command literals.

Example: EnforcedStyle: backticks (default)

# bad
folders = %x(find . -type d).split

# bad
%x(
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
)

# good
folders = `find . -type d`.split

# good
`
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
`

Example: EnforcedStyle: mixed

# bad
folders = %x(find . -type d).split

# bad
`
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
`

# good
folders = `find . -type d`.split

# good
%x(
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
)

Example: EnforcedStyle: percent_x

# bad
folders = `find . -type d`.split

# bad
`
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
`

# good
folders = %x(find . -type d).split

# good
%x(
  ln -s foo.example.yml foo.example
  ln -s bar.example.yml bar.example
)

Example: AllowInnerBackticks: false (default)

# If `false`, the cop will always recommend using `%x` if one or more
# backticks are found in the command string.

# bad
`echo \`ls\``

# good
%x(echo `ls`)

Example: AllowInnerBackticks: true

# good
`echo \`ls\``

Literal Opal.global.React === undefined || Opal.global.React.version === undefined appeared as a condition.
Open

  if `Opal.global.React === undefined || Opal.global.React.version === undefined`
Severity: Minor
Found in lib/hyper-react.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

Unused method argument - name. If it's necessary, use _ or _name as an argument name to indicate that it won't be used. You can also write as action_missing(*) if you want the method to accept any arguments but don't care about them.
Open

          def action_missing(name)
Severity: Minor
Found in lib/reactive-ruby/rails/railtie.rb by rubocop

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
Severity
Category
Status
Source
Language