lambda
/proc
instead of a plain method call RB-RL1052Scope calls should not pass a method (usually a scope) instead of a lambda/proc.
BEGIN
block detected RB-ST1009BEGIN
blocks should not be used.
When using array syntax, adding an element in a position other than the last causes all previous definitions to shift. Explicitly specifying the value for each key prevents this from happening.
The referer from the request
object should be accessed in a consistent way throughout the codebase. By default, this issue is raised when referrer
is used. However, it can be configured to raise this issue on usage of referer
in .rubocop.yml
.
Method definitions that aren't used can be removed. Some examples of purposeless method definitions include empty constructors and methods just delegating to super.
start_with
in place of regex RB-PR1021If a regex only checks if the string starts with a particular string, String#start_with?
can be used as a simpler and more efficient method.
The hash contains duplicate keys. While this is allowed by Ruby, this usually happens due to typos, and is, in most cases, unintended.
Each method in a scope should have a unique name. Having multiple methods with the same name is usually a result of typos.
Array.new()
with a block instead of .times
RB-PR1023each_with_object
is called with an immutable argument RB-LI1014Since the argument is the object that the given block shall make calls on to build something based on the enumerable that eachwithobject iterates over, an immutable argument makes no sense. It's definitely a bug.
ensure
block detected RB-LI1016The ensure
block must not be empty.
when
branch without a body detected RB-LI1019END
detected in a method RB-LI1020END
block is detected in a method. at_exit
should be used instead.
The parameters supplied for formatting the string do not match the specified parameters.
Methods on a heredoc should be invoked at beginning, not at the end.
private
or protected
access modifiers which are applied to a singleton method do not make them private/protected. private_class_method
can be used for that.
Interpolations do not work in single-quote strings. Double quotes must be used.
Literals used in interpolations are pointless, and can be replaced by the literal directly.
while
/until
detected in begin
block RB-LI1033while
/until
should be used at the beginning of the block, and without the begin
statement.