Pass __FILE__
and __LINE__
to eval
method, as they are used by backtraces. Open
eval("post :destroy, { :urlified_name => 'site', :controller => @base_class.tableize, :id => 1 }.merge(location)")
- Read upRead up
- Exclude checks
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
Unused method argument - location
. If it's necessary, use _
or _location
as an argument name to indicate that it won't be used. You can also write as create_record(*)
if you want the method to accept any arguments but don't care about them. Open
def create_record(attributes = {}, location = {})
- Read upRead up
- Exclude checks
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
Pass __FILE__
and __LINE__
to eval
method, as they are used by backtraces. Open
eval("post :update, { :#{attributes_name} => @updated_model.merge(attributes), :urlified_name => 'site', :controller => @base_class.tableize, :id => 1 }.merge(location)")
- Read upRead up
- Exclude checks
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
Unused method argument - attributes
. If it's necessary, use _
or _attributes
as an argument name to indicate that it won't be used. You can also write as create_record(*)
if you want the method to accept any arguments but don't care about them. Open
def create_record(attributes = {}, location = {})
- Read upRead up
- Exclude checks
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
The use of eval
is a serious security risk. Open
assert_equal value, eval("assigns(:#{var}).#{key}")
- Read upRead up
- Exclude checks
This cop checks for the use of Kernel#eval
and Binding#eval
.
Example:
# bad
eval(something)
binding.eval(something)
The use of eval
is a serious security risk. Open
eval("post :create, { :#{attributes_name} => @new_model.merge(attributes), :urlified_name => 'site', :controller => @base_class.tableize }.merge(location)")
- Read upRead up
- Exclude checks
This cop checks for the use of Kernel#eval
and Binding#eval
.
Example:
# bad
eval(something)
binding.eval(something)
The use of eval
is a serious security risk. Open
eval("post :update, { :#{attributes_name} => @updated_model.merge(attributes), :urlified_name => 'site', :controller => @base_class.tableize, :id => 1 }.merge(location)")
- Read upRead up
- Exclude checks
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
assert_equal value, eval("assigns(:#{var}).#{key}")
- Read upRead up
- Exclude checks
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
Unused method argument - location
. If it's necessary, use _
or _location
as an argument name to indicate that it won't be used. You can also write as update_record(*)
if you want the method to accept any arguments but don't care about them. Open
def update_record(attributes = {}, location = {})
- Read upRead up
- Exclude checks
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
Unused method argument - attributes
. If it's necessary, use _
or _attributes
as an argument name to indicate that it won't be used. You can also write as update_record(*)
if you want the method to accept any arguments but don't care about them. Open
def update_record(attributes = {}, location = {})
- Read upRead up
- Exclude checks
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
Unused method argument - location
. If it's necessary, use _
or _location
as an argument name to indicate that it won't be used. You can also write as destroy_record(*)
if you want the method to accept any arguments but don't care about them. Open
def destroy_record(location = {})
- Read upRead up
- Exclude checks
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
Pass __FILE__
and __LINE__
to eval
method, as they are used by backtraces. Open
eval("post :create, { :#{attributes_name} => @new_model.merge(attributes), :urlified_name => 'site', :controller => @base_class.tableize }.merge(location)")
- Read upRead up
- Exclude checks
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