New features
- #3560: Add a configuration option
empty_lines_except_namespace
toStyle/EmptyLinesAroundClassBody
andStyle/EmptyLinesAroundModuleBody
. (@legendetm) - #3370: Add new
Rails/HttpPositionalArguments
cop to check your Rails 5 test code for existence of positional args usage. (@logicminds) - #3510: Add a configuration option,
ConvertCodeThatCanStartToReturnNil
, toStyle/SafeNavigation
to check for code that could start returningnil
if safe navigation is used. (@rrosenblum) - Add a new
AllCops/StyleGuideBaseURL
setting that allows the use of relative paths and/or fragments within each cop'sStyleGuide
setting, to make forking of custom style guides easier. (@scottmatthewman) - #3566: Add new
Metric/BlockLength
cop to ensure blocks don't get too long. (@savef) - #3428: Add support for configuring
Style/PreferredHashMethods
with eithershort
orverbose
style method names. (@abrom) - #3455: Add new
Rails/DynamicFindBy
cop. (@pocke) - #3542: Add a configuration option,
IgnoreCopDirectives
, toMetrics/LineLength
to stop cop directives (# rubocop:disable Metrics/AbcSize
) from being counted when considering line length. (@jmks) - Add new
Rails/DelegateAllowBlank
cop. (@connorjacobsen) - Add new
Style/MultilineMemoization
cop. (@drenmi)
Bug fixes
- #3103: Make
Style/ExtraSpacing
cop register an offense for extra spaces present in single-line hash literals. (@tcdowney) - #3513: Fix false positive in
Style/TernaryParentheses
for a ternary with ranges. (@dreyks) - #3520: Fix regression causing
Lint/AssignmentInCondition
false positive. (@savef) - #3514: Make
Style/VariableNumber
cop not register an offense when valid normal case variable names have an integer after the first_
. (@b-t-g) - #3516: Make
Style/VariableNumber
cop not register an offense when valid normal case variable names have an integer in the middle. (@b-t-g) - #3436: Make
Rails/SaveBang
cop not register an offense when return value of a non-bang method is returned by the parent method. (@coorasse) - #3540: Fix
Style/GuardClause
to register offense for instance and singleton methods. (@tejasbubane) - #3311: Detect incompatibilities with the external encoding to prevent bad autocorrections in
Style/StringLiterals
. (@deivid-rodriguez) - #3499: Ensure
Lint/UnusedBlockArgument
doesn't make recommendations that would change arity for methods defined using#define_method
. (@drenmi) - #3430: Fix exception in
Performance/RedundantMerge
when inspecting a#merge!
with implicit receiver. (@drenmi) - #3411: Avoid auto-correction crash for single
when
inPerformance/CaseWhenSplat
. (@jonas054) - #3286: Allow
self.a, self.b = b, a
inStyle/ParallelAssignment
. (@jonas054) - #3419: Report offense for
unless x.nil?
inStyle/NonNilCheck
ifIncludeSemanticChanges
istrue
. (@jonas054) - #3382: Avoid auto-correction crash for multiple elsifs in
Style/EmptyElse
. (@lumeet) - #3334: Do not register an offense for a literal space (
\s
) inStyle/UnneededCapitalW
. (@rrosenblum) - #3390: Fix SaveBang cop for multiple conditional. (@tejasbubane)
- #3577: Fix
Style/RaiseArgs
not allowing compact raise with splatted args. (@savef) - #3578: Fix safe navigation method call counting in
Metrics/AbcSize
. (@savef) - #3592: Fix
Style/RedundantParentheses
for indexing with literals. (@thegedge) - #3597: Fix the autocorrect of
Performance/CaseWhenSplat
when trying to rearange splat expanded variables to the end of a when condition. (@rrosenblum)
Changes
- #3512: Change error message of
Lint/UnneededSplatExpansion
for array in method parameters. (@tejasbubane) - #3510: Fix some issues with
Style/SafeNavigation
. Fix auto-correct of multiline if expressions, and do not register an offense for scenarios using||
and ternary expression. (@rrosenblum) - #3503: Change misleading message of
Style/EmptyLinesAroundAccessModifier
. (@bquorning) - #3407: Turn off autocorrect for unsafe rules by default. (@ptarjan)
- #3521: Turn off autocorrect for
Security/JSONLoad
by default. (@savef) - #2903:
Style/RedundantReturn
looks for redundantreturn
inside conditional branches. (@lumeet)