A Ruby static code analyzer and formatter, based on the community Ruby style guide.
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)Style/ArgumentsForwarding
when using block argument forwarding with other arguments. (@koic)Style/RedundantParentheses
when parentheses in control flow keyword with multiline style argument. (@koic)Style/MultilineTernaryOperator
when using a method call as a ternary operator condition with a line break between receiver and method. (@koic)Style/RedundantLineContinuation
when line continuations for multiline leading dot method chain with a blank line. (@koic)Style/MethodCallWithArgsParentheses
omit_parentheses
style. (@gsamokovarov)Layout/EndAlignment
when misaligned in singleton class assignments with EnforcedStyleAlignWith: variable
. (@koic)Layout/FirstArgumentIndentation
when specifying EnforcedStyle: with_fixed_indentation
of Layout/ArrayAlignment
. (@koic)Lint/ShadowedArgument
when self assigning to a block argument in for
. (@koic)Style/IdenticalConditionalBranches
when using if
...else
with identical leading lines that assign to self.foo
. (@koic)EnforcedStyle: omit_parentheses
of Style/MethodCallWithArgsParentheses
with Style/SuperWithArgsParentheses
. (@koic)Style/MapToHash
when using map.to_h
without receiver. (@koic)--auto-gen-config
generate Exclude
when Max
is overridden. (@jonas054)Lint/MixedRegexpCaptureTypes
when using look-ahead matcher. (@marocchino)Style/RedundantParentheses
when regexp literal attempts to match against a parenthesized condition. (@koic)Lint/LiteralAssignmentInCondition
when a collection literal contains non-literal elements. (@koic)Naming/BlockForwarding
when using explicit block forwarding in block method. (@koic)Style/RedundantParentheses
when AllowInMultilineConditions: true
of Style/ParenthesesAroundCondition
. (@koic)Style/ArgumentsForwarding
when rest arguments forwarding to a method in block. (@koic)Style/HashEachMethods
when rest block argument of Enumerable#each
method is used. (@koic)Style/ParenthesesAroundCondition
. (@koic)Style/RedundantParentheses
when parentheses are used around a semantic operator in expressions within assignments. (@koic)Style/ArgumentsForwarding
when a block is forwarded but other args aren't. (@dvandersluis)Layout/LineContinuationLeadingSpace
. (@eugeneius)Style/EachForSimpleLoop
accept block with no parameters. (@koic)Security/Open
when open
with a literal string starting with a pipe. (@koic)Style/RedundantEach
aware of safe navigation operator. (@koic)Style/SlicingWithRange
aware of redundant and beginless range. (@koic)EnforcedStyle
options when --no-auto-gen-enforced-style
is given. (@kpost)Lint/LiteralAssignmentInCondition
when using interpolated string or xstring literals. (@koic)Lint/SelfAssignment
when using attribute assignment with method call with arguments. (@koic)Style/HashEachMethods
when receiver literal is not a hash literal. (@koic)Style/MethodCallWithArgsParentheses
when EnforcedStyle: omit_parentheses
and parens in when
clause is used to pass an argument. (@koic)Style/RedundantParentheses
when using parenthesized lambda
or proc
with do
...end
block. (@koic)Style/CombinableLoops
when looping over the same data as previous loop in do
...end
and {
...}
blocks. (@koic)Lint/LiteralAssignmentInCondition
when using parallel assignment with splat operator in block of guard condition. (@koic)Style/HashEachMethods
when using destructed block arguments. (@koic)Style/RedundantParentheses
when a part of range is a parenthesized condition. (@koic)Style/MapToHash
when using dot method calls for to_h
. (@koic)Lint/HashCompareByIdentity
aware of safe navigation operator. (@koic)Lint/NextWithoutAccumulator
aware of safe navigation operator. (@koic)Lint/NumberConversion
aware of safe navigation operator. (@koic)Lint/RedundantWithIndex
aware of safe navigation operator. (@koic)Lint/RedundantWithObject
aware of safe navigation operator. (@koic)Lint/UnmodifiedReduceAccumulator
aware of safe navigation operator. (@koic)Style/ClassCheck
aware of safe navigation operator. (@koic)Style/CollectionCompact
aware of safe navigation operator. (@koic)Style/ConcatArrayLiterals
aware of safe navigation operator. (@koic)Style/DateTime
aware of safe navigation operator. (@koic)Style/EachWithObject
aware of safe navigation operator. (@koic)Style/HashExcept
aware of safe navigation operator. (@koic)Style/MapCompactWithConditionalBlock
aware of safe navigation operator. (@koic)Style/Next
aware of safe navigation operator. (@koic)Style/RedundantArgument
aware of safe navigation operator. (@koic)Style/RedundantFetchBlock
aware of safe navigation operator. (@koic)Layout/RedundantLineBreak
aware of safe navigation operator. (@koic)Style/RedundantSortBy
aware of safe navigation operator. (@koic)Style/RedundantSortBy
aware of safe navigation operator. (@koic)Style/ExactRegexpMatch
aware of safe navigation operator. (@koic)Style/Sample
aware of safe navigation operator. (@koic)Style/SelectByRegexp
cops aware of safe navigation operator. (@koic)Layout/SingleLineBlockChain
aware of safe navigation operator. (@koic)Style/StringChars
aware of safe navigation operator. (@koic)Style/Strip
aware of safe navigation operator. (@koic)Style/UnpackFirst
aware of safe navigation operator. (@koic)