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
.
When using ActiveSupport's number pluralization, proper aliases should be used for readablity. For example, 1.day.ago
, while equivalent to 1.days.ago
, does not make grammatical sense.
Do not put a space between method name and left parenthesis, it makes the code ambiguous to read.
Access group modifiers should be declared as a group.
alias
detected RB-ST1002A block accepting version of the method can be used that does automatic resource cleanup.
The annotation keyword is followed by a colon and a space, then a note describing the problem. Supported keywords are TODO
, FIXME
, OPTIMIZE
, HACK
and REVIEW
.
Comments, when put on the same line as some keywords (begin
, class
, def
, end
, module
), cause this issue.
__dir__
to get an absolute path to the current file's directory RB-ST1030#__dir__
method can replace more complex constructs to retrieve a canonicalized absolute path to the current file.
Put the end
of empty method definitions on the next line. A method definition is not considered empty if it contains comments.
By default, this issue is raised when using try!
in place of &.
. try
can be detected, too, if configured in .rubocop.yml
. For example, if try
is detected too
Using def self.method_name
or class << self
to define class methods is recommended.
The use of %x
must be avoided unless a command is to be invoked with backquotes in it (which is rather unlikely).