decko-commons/decko

View on GitHub
card/lib/cardio/mod/load_strategy/set_binding_magic.rb

Summary

Maintainability
A
0 mins
Test Coverage

The use of eval is a serious security risk.
Open

          eval "#{set_module}.module_eval ::File.read('#{abs_path}'), '#{abs_path}'",

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

          eval "#{set_module}.module_eval ::File.read('#{abs_path}'), '#{abs_path}'",
               module_path_binding(set_module)

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
Open

            eval(
              "[ #{part} , #{part}.module_eval('binding') ]",
              b
            )

This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

Example:

# bad
eval <<-RUBY
  def do_something
  end
RUBY

# bad
C.class_eval <<-RUBY
  def do_something
  end
RUBY

# good
eval <<-RUBY, binding, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

# good
C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
  def do_something
  end
RUBY

The use of eval is a serious security risk.
Open

            eval(

This cop checks for the use of Kernel#eval and Binding#eval.

Example:

# bad

eval(something)
binding.eval(something)

There are no issues that match your filters.

Category
Status