Showing 659 of 659 total issues
Do not use prefix _
for a variable that is used. Open
_x, _y, _z = *@elements
- Read upRead up
- Exclude checks
This cop checks for underscore-prefixed variables that are actually used.
Example:
# bad
[1, 2, 3].each do |_num|
do_something(_num)
end
Example:
# good
[1, 2, 3].each do |num|
do_something(num)
end
Example:
# good
[1, 2, 3].each do |_num|
do_something # not using `_num`
end
Unused block argument - window_handle
. If it's necessary, use _
or _window_handle
as an argument name to indicate that it won't be used. Open
@char_callback = ::GLFW::create_callback(:GLFWcharfun) do |window_handle, codepoint|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end
Unused method argument - camera
. If it's necessary, use _
or _camera
as an argument name to indicate that it won't be used. Open
def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)
- 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 block argument - i
. You can omit the argument if you don't care about it. Open
num_faces.times do |i|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end
Unused method argument - url
. If it's necessary, use _
or _url
as an argument name to indicate that it won't be used. You can also write as item_end(*)
if you want the method to accept any arguments but don't care about them. Open
def item_end(url)
- 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 block argument - p
. If it's necessary, use _
or _p
as an argument name to indicate that it won't be used. Open
positions.each_slice(9).with_index do |p, i|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end
Do not use prefix _
for a variable that is used. Open
_x, _y, _z = *@elements
- Read upRead up
- Exclude checks
This cop checks for underscore-prefixed variables that are actually used.
Example:
# bad
[1, 2, 3].each do |_num|
do_something(_num)
end
Example:
# good
[1, 2, 3].each do |num|
do_something(num)
end
Example:
# good
[1, 2, 3].each do |_num|
do_something # not using `_num`
end
Unused block argument - window_handle
. If it's necessary, use _
or _window_handle
as an argument name to indicate that it won't be used. Open
@frabuffer_size_callback = ::GLFW::create_callback(:GLFWframebuffersizefun) do |window_handle, new_width, new_height|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end
Unused block argument - v
. If it's necessary, use _
or _v
as an argument name to indicate that it won't be used. Open
attributes.each do |k, v|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end
Unused method argument - lights
. If it's necessary, use _
or _lights
as an argument name to indicate that it won't be used. Open
def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)
- 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 - lights
. If it's necessary, use _
or _lights
as an argument name to indicate that it won't be used. Open
def render_buffer(camera, lights, fog, material, geometry_group, update_buffers)
- 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
Do not use prefix _
for a variable that is used. Open
_x, _y, _z, _w = *@elements
- Read upRead up
- Exclude checks
This cop checks for underscore-prefixed variables that are actually used.
Example:
# bad
[1, 2, 3].each do |_num|
do_something(_num)
end
Example:
# good
[1, 2, 3].each do |num|
do_something(num)
end
Example:
# good
[1, 2, 3].each do |_num|
do_something # not using `_num`
end
Do not use prefix _
for a variable that is used. Open
_x, _y, _z = *@elements
- Read upRead up
- Exclude checks
This cop checks for underscore-prefixed variables that are actually used.
Example:
# bad
[1, 2, 3].each do |_num|
do_something(_num)
end
Example:
# good
[1, 2, 3].each do |num|
do_something(num)
end
Example:
# good
[1, 2, 3].each do |_num|
do_something # not using `_num`
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
while line = read_line(stream)
- Read upRead up
- Exclude checks
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
Use ==
if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition. Open
while line = read_line(stream)
- Read upRead up
- Exclude checks
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
Unused method argument - color_hash
. If it's necessary, use _
or _color_hash
as an argument name to indicate that it won't be used. Open
def get_color_index(color, color_hash, colors)
- 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
unexpected token tRCURLY
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
}.reject { |k,v| v.nil? || v == [] }
- Exclude checks
Unused block argument - window_handle
. If it's necessary, use _
or _window_handle
as an argument name to indicate that it won't be used. Open
@cursor_pos_callback = ::GLFW::create_callback(:GLFWcursorposfun) do |window_handle, xpos, ypos|
- Read upRead up
- Exclude checks
This cop checks for unused block arguments.
Example:
# bad
do_something do |used, unused|
puts used
end
do_something do |bar|
puts :foo
end
define_method(:foo) do |bar|
puts :baz
end
Example:
#good
do_something do |used, _unused|
puts used
end
do_something do
puts :foo
end
define_method(:foo) do |_bar|
puts :baz
end
Unused method argument - material
. If it's necessary, use _
or _material
as an argument name to indicate that it won't be used. Open
def update_uv_buffers(uv_attribute, uv2_attribute, object, material)
- 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
end
at 139, 12 is not aligned with case
at 134, 19. Open
end
- Read upRead up
- Exclude checks
This cop checks whether the end keywords are aligned properly.
Three modes are supported through the EnforcedStyleAlignWith
configuration parameter:
If it's set to keyword
(which is the default), the end
shall be aligned with the start of the keyword (if, class, etc.).
If it's set to variable
the end
shall be aligned with the
left-hand-side of the variable assignment, if there is one.
If it's set to start_of_line
, the end
shall be aligned with the
start of the line where the matching keyword appears.
Example: EnforcedStyleAlignWith: keyword (default)
# bad
variable = if true
end
# good
variable = if true
end
Example: EnforcedStyleAlignWith: variable
# bad
variable = if true
end
# good
variable = if true
end
Example: EnforcedStyleAlignWith: startofline
# bad
variable = if true
end
# good
puts(if true
end)