New features
- #4107: New
TargetRailsVersion
configuration parameter can be used to specify which version of Rails the inspected code is intended to run on. (@maxbeizer) - #4104: Add
prefix
andpostfix
styles toStyle/NegatedIf
. (@brandonweiss) - #4083: Add new configuration
NumberOfEmptyLines
forStyle/EmptyLineBetweenDefs
. (@dorian) - #4045: Add new configuration
Strict
forStyle/NumericLiteral
to make the change to this cop in 0.47.0 configurable. (@iGEL) - #4005: Add new
AllCops/EnabledByDefault
option. (@betesh) - #3893: Add a new configuration,
IncludeActiveSupportAliases
, toPerformance/DoublStartEndWith
. This configuration will check for ActiveSupport'sstarts_with?
andends_with?
. (@rrosenblum) - #3889: Add new
Style/EmptyLineAfterMagicComment
cop. (@backus) - #3800: Make
Style/EndOfLine
configurable withlf
,crlf
, andnative
(default) styles. (@jonas054) - #3936: Add new
Style/MixinGrouping
cop. (@drenmi) - #4003: Add new
Rails/RelativeDateConstant
cop. (@sinsoku) - #3984: Add new
Style/EmptyLinesAroundBeginBody
cop. (@pocke) - #3995: Add new
Style/EmptyLinesAroundExceptionHandlingKeywords
cop. (@pocke) - #4019: Make configurable
Style/MultilineMemoization
cop. (@pocke) - #4018: Add autocorrect
Lint/EmptyEnsure
cop. (@pocke) - #4028: Add new
Style/IndentHeredoc
cop. (@pocke) - #3931: Add new
Lint/AmbiguousBlockAssociation
cop. (@smakagon) - Add new
Style/InverseMethods
cop. (@rrosenblum) - #4038: Allow
default
key in theStyle/PercentLiteralDelimiters
cop config to set all preferred delimiters. (@kddeisz) - Add
IgnoreMacros
option toStyle/MethodCallWithArgsParentheses
. (@drenmi) - #3937: Add new
Rails/ActiveSupportAliases
cop. (@tdeo) - Add new
Rails/Blank
cop. (@rrosenblum) - Add new
Rails/Present
cop. (@rrosenblum)
Changes
- #4100: Rails/SaveBang should flag
update_attributes
. (@andriymosin) - #4083:
Style/EmptyLineBetweenDefs
doesn't allow more than one empty line between method definitions by default (seeNumberOfEmptyLines
). (@dorian) - #3997: Include all ruby files by default and exclude non-ruby files. (@dorian)
- #4012: Mark
foo[:bar]
as not complex inStyle/TernaryParentheses
cop withrequire_parentheses_when_complex
style. (@onk) - #3915: Make configurable whitelist for
Lint/SafeNavigationChain
cop. (@pocke) - #3944: Allow keyword arguments in
Style/RaiseArgs
cop. (@mikegee) - Add auto-correct to
Performance/DoubleStartEndWith
. (@rrosenblum) - #3951: Make
Rails/Date
cop to register an offence for a string without timezone. (@sinsoku) - #4020: Fixed
new_cop.rake
suggested path. (@dabroz) - #4055: Add parameters count to offense message for
Metrics/ParameterLists
cop. (@pocke) - #4081: Allow
Marshal.load
if argument is aMarshal.dump
inSecurity/MarshalLoad
cop. (@droptheplot) - #4124: Make
Style/SymbolArray
cop to enable by default. (@pocke) - #3331: Change
Style/MultilineMethodCallIndentation
indented_relative_to_receiver
to indent relative to the reciever and not relative to the caller. (@jfelchner) - #4137: Allow lines to be exempted from
IndentationWidth
by regex. (@jfelchner)
Bug fixes
- #4007: Skip
Rails/SkipsModelValidations
for methods that don't accept arguments. (@dorian) - #3923: Allow asciibetical sorting in
Bundler/OrderedGems
. (@mikegee) - #3855: Make
Lint/NonLocalExitFromIterator
aware of method definitions. (@drenmi) - #2643: Allow uppercase and dashes in
MagicComment
. (@mikegee) - #3959: Don't wrap "percent arrays" with extra brackets when autocorrecting
Style/MutableConstant
. (@mikegee) - #3978: Fix false positive in
Performance/RegexpMatch
withEnglish
module. (@pocke) - #3242: Ignore
Errno::ENOENT
during cache cleanup fromFile.mtime
too. (@mikegee) - #3958:
Style/SpaceInsideHashLiteralBraces
doesn't add and offence when checking an hash where a value is a left brace string (e.g. { k: '{' }). (@nodo) - #4006: Prevent
Style/WhileUntilModifier
from breaking on a multiline modifier. (@drenmi) - #3345: Allow
Style/WordArray
'sWordRegex
configuration value to be an instance ofString
. (@mikegee) - #4013: Follow redirects for RemoteConfig. (@buenaventure)
- #3917: Rails/FilePath Match nodes in a method call only once. (@unmanbearpig)
- #3673: Fix regression on
Style/RedundantSelf
when assigning to same local variable. (@bankair) - #4047: Allow
find_zone
andfind_zone!
methods inRails/TimeZone
. (@attilahorvath) - #3457: Clear a warning and prevent new warnings. (@mikegee)
- #4066: Register an offense in
Lint/ShadowedException
when an exception is shadowed and there is an implicit begin. (@rrosenblum) - #4001: Lint/UnneededDisable of Metrics/LineLength that isn't unneeded. (@wkurniawan07)
- #3960: Let
Include
/Exclude
paths in all files beginning with.rubocop
be relative to the configuration file's directory and not to the current directory. (@jonas054) - #4049: Bugfix for
Style/EmptyLiteral
cop. (@ota42y) - #4112: Fix false positives about double quotes in
Style/StringLiterals
,Style/UnneededCapitalW
andStyle/UnneededPercentQ
cops. (@pocke) - #4109: Fix incorrect auto correction in
Style/SelfAssignment
cop. (@pocke) - #4110: Fix incorrect auto correction in
Style/BracesAroundHashParameters
cop. (@musialik) - #4084: Fix incorrect auto correction in
Style/TernaryParentheses
cop. (@musialik) - #4102: Fix
Security/JSONLoad
,Security/MarshalLoad
andSecurity/YAMLLoad
cops patterns not matching ::Const. (@musialik) - #3580: Handle combinations of
# rubocop:disable all
and# rubocop:disable SomeCop
. (@jonas054) - #4124: Fix auto correction bugs in
Style/SymbolArray
cop. (@pocke) - #4128: Prevent
Style/CaseIndentation
cop from registering offenses on single-line case statements. (@drenmi) - #4143: Prevent
Style/IdenticalConditionalBranches
from registering offenses when a case statement has an empty when. (@dpostorivo)