Showing 659 of 659 total issues
Unused block argument - m
. You can omit the argument if you don't care about it. Open
@num_morph_normals.times do |m|
- 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 - i
. You can omit the argument if you don't care about it. Open
3.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
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, _w = @x, @y, @z, @w
- 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 method argument - show_status
. If it's necessary, use _
or _show_status
as an argument name to indicate that it won't be used. You can also write as initialize(*)
if you want the method to accept any arguments but don't care about them. Open
def initialize(show_status = false)
- 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 tCOMMA
(Using Ruby 2.1 parser; configure using TargetRubyVersion
parameter, under AllCops
) Open
user_data: @user_data&.empty? ? nil : @user_data,
- 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
@mouse_button_callback = ::GLFW::create_callback(:GLFWmousebuttonfun) do |window_handle, button, action, mods|
- 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
Avoid more than 4 levels of block nesting. Open
if @renderer.compressed_texture_formats.include?(gl_format)
GL.CompressedTexImage2D(GL::TEXTURE_CUBE_MAP_POSITIVE_X + i, j, gl_format, mipmap.width, mipmap.height, 0, mipmap.data)
else
puts "WARNING: Mittsu::OpenGLCubeTexture: Attempt to load unsupported compressed texture format in #set"
end
- Read upRead up
- Exclude checks
This cop checks for excessive nesting of conditional and looping constructs.
You can configure if blocks are considered using the CountBlocks
option. When set to false
(the default) blocks are not counted
towards the nesting level. Set to true
to count blocks as well.
The maximum level of nesting allowed is configurable.
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 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 = *@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
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
@scroll_callback = ::GLFW::create_callback(:GLFWscrollfun) do |window_handle, xoffset, yoffset|
- 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
Literal false
appeared as a condition. Open
if false # material.is_a?(RawShaderMaterial) # TODO: when RawShaderMaterial exists
- Read upRead up
- Exclude checks
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 - fog
. If it's necessary, use _
or _fog
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
Comparison of something with itself detected. Open
tmax = tzmax if tzmax < tmax || tmax != tmax
- Read upRead up
- Exclude checks
This cop checks for comparison of something with itself.
Example:
# bad
x.top >= x.top
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
if i = @vertex_hash[key]
- 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 - 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_start(*)
if you want the method to accept any arguments but don't care about them. Open
def item_start(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