A Ruby static code analyzer and formatter, based on the community Ruby style guide.
Layout/FirstArgumentIndentation
when specifying EnforcedStyle: with_fixed_indentation
of Layout/ArrayAlignment
. (@koic)Metrics/BlockLength
when the CountAsOne
config is invalid. (@koic)Style/NumericPredicate
is used with negations. (@fatkodima)Layout/CommentIndentation
for comment-only pattern matching. (@nekketsuuu)rubocop -V
when .rubocop.yml
contains ERB. (@earlopain)Style/RedundantLineContinuation
when line continuations involve return
with a return value. (@koic)textDocument/diagnostic
. (@muxcmux)bundle exec
. (@amomchilov)Lint/MixedCaseRange
when a character between Z
and a
is used in the regexp range. (@koic)RuboCop::Lockfile
when there is no Bundler environment. (@koic)Style/ArgumentsForwarding
when using block arg in nested method definitions. (@koic)Lint/UnreachableLoop
when using pattern matching. (@koic)Lint/AssignmentInCondition
if assigning inside a method call. (@earlopain)RuboCop::Lockfile::Bundler
", caused when running RuboCop without bundler exec
on codebases that use rubocop-rails
. (@amomchilov)Style/MapIntoArray
cop. (@ymap)requires_gem
API for declaring which gems a Cop needs. (@amomchilov)Lint/RedundantWithIndex
when calling with_index
with receiver and a block. (@koic)Style/Alias
with EnforcedStyle: prefer_alias
when calling alias_method
with fewer than 2 arguments. (@earlopain)Style/ExactRegexpMatch
when calling match
without a receiver. (@earlopain)Style/RedundantEach
when using reverse_each.each
without a block. (@earlopain)&.
the same way as .
for setter methods in Lint/AssignmentInCondition
. (@jonas054)Style/RedundantLineContinuation
when using line continuation with modifier. (@koic)Naming/BlockForwarding
when using explicit block forwarding in block method and others. (@koic)Style/EvalWithLocation
when using eval
with a line number from a method call or a variable. (@koic)Style/RedundantArgument
when when single-quoted strings for cntrl character. (@koic)Style/RedundantLineContinuation
when using line continuations with &&
or ||
operator in assignment. (@koic)Style/RedundantLineContinuation
when multi-line continuations with operators. (@koic)Style/CollectionCompact
when using delete_if
. (@koic)Style/RedundantPercentQ
safe on multiline strings. (@boardfish)Naming/FileName
and Naming/InclusiveLanguage
for empty files. (@earlopain)Style/Copyright
when the file is empty. (@earlopain)Lint/Debugger
. (@ydah)Rakefile.rb
in Naming/FileName
in the default config. (@artur-intech)Lint/Debugger
aware of ruby/debug
requires. (@earlopain)rubocop -V
display rubocop-rspec_rails version when using it. (@ydah)Bundler::LockfileParser
. (@amomchilov)Style/HashEachMethods
when the key block argument of Enumerable#each
method is unused after chunk
. (@koic)Style/NilComparison
without receiver and EnforcedStyle: comparison
. (@earlopain)Gemspec/RequiredRubyVersion
when the file is empty. (@earlopain)Lint/RedundantWithIndex
when the method has no receiver. (@earlopain)Lint/UselessTimes
when no block is present. (@earlopain)Style/ClassVars
when calling class_variable_set
without arguments. (@earlopain)Style/For
with EnforcedStyle: for
when no receiver. (@earlopain)Layout/MultilineMethodCallIndentation
with safe navigation and assignment method. (@earlopain)Lint/MixedCaseRange
with invalid byte sequence in UTF-8. (@earlopain)RedundantCurrentDirectoryInPath
in case of require_relative
without arguments. (@viralpraxis)Layout/EmptyLineAfterMagicComment
when the file is comments only. (@earlopain)Layout/RedundantLineBreak
when using &&
or ||
after a backslash newline. (@koic)Style/MultilineMethodSignature
when there is a newline directly after the def keyword. (@earlopain)Style/RaiseArgs
with EnforcedStyle: compact
when passing more than 2 arguments to raise
. (@earlopain)Lint/Syntax
getting disabled by rubocop:disable Lint/Syntax
. (@earlopain)LineLength
phase on --auto-gen-only-exclude
. (@sambostock)Note: This is the first RuboCop release that features (experimental) support for using Prism
instead of the parser
gem. Check out the docs for more details.
See also this article for additional context.
TargetRubyVersion 3.4
(experimental). (@koic)Lint/ToEnumArguments
when enumerator is created for another method in no arguments method definition. (@koic)Style/RedundantLineContinuation
when using line concatenation and calling a method with keyword arguments without parentheses. (@koic)Style/Encoding
when magic encoding with mixed case present. (@koic)required_ruby_version
is read from another file. (@davidrunger)Layout/SpaceInsideHashLiteralBraces
. (@bquorning)--editor-mode
CLI option. (@koic)AutoCorrect: contextual
option for LSP. (@koic)OffenseCountFormatter
display autocorrection information. (@koic)RuboCop::LSP.enable
API to enable LSP mode. (@koic).rubocop.yml
and rubocop/config.yml
in compliance with dot-config. (@koic)Style/ArgumentsForwarding
when using block arg forwarding to within block with Ruby 3.3.0. (@koic)Gemspec/RequiredRubyVersion
when required_ruby_version
is specified with Gem::Requirement.new
and is higher than TargetRubyVersion
. (@koic)Style/CaseLikeIf
when using ==
with literal and using ternary operator. (@koic)Lint/EmptyConditionalBody
when missing if
body with conditional else
body. (@koic)Style/MapCompactWithConditionalBlock
when using guard clause with next
implicitly nil. (@koic)Style/ObjectThen
when using yield_self
without receiver. (@koic)--auto-gen-config
bug for Layout/SpaceBeforeBlockBraces
. (@jonas054)Style/CommentedKeyword
. (@jonas054)Include
from inherited file in a parent directory. (@jonas054)Layout/RedundantLineBreak
when using index access call chained on multiline hash literal. (@koic)Style/MultilineTernaryOperator
when nesting multiline ternary operators. (@koic)Style/RedundantAssignment
when using pattern matching. (@koic)Style/RedundantReturn
when using pattern matching. (@koic)Lint/RedundantSafeNavigation
when using safe navigation operator for literal receiver. (@koic)Style/ArgumentsForwarding
when using forwardable block arguments with Ruby 3.2+. (@koic)Lint/Void
when each
block with conditional expressions that has multiple statements. (@koic)Style/InverseMethods
when using relational comparison operator with safe navigation. (@koic)Style/InvertibleUnlessCondition
. (@sambostock)omit_parentheses
Style/MethodCallWithArgsParentheses
. (@gsamokovarov)Style/RaiseArgs
as unsafe. (@r7kamura)Layout/RedundantLineBreak
when using index access call chained on multiple lines with backslash. (@koic)Style/ArgumentsForwarding
when naming a block argument &
. (@koic)Style/HashEachMethods
when both arguments are unused. (@earlopain)Style/HashEachMethods
when a block with both parameters has no body. (@earlopain)Errno::ENOENT
error when using server mode. (@koic)Style/ArgumentsForwarding
when using block arg forwarding with positional arguments forwarding to within block. (@koic)Style/HashEachMethods
when using array converter method. (@koic)EnforcedStyle: explicit
of Naming/BlockForwarding
with Style/ArgumentsForwarding
. (@koic)