Special thanks to Alex Dowad who
contributed an amazing number of bug fixes and improvements for this
release! Much appreciated!
And happy birthday to my beloved granny Vasilka, who turns today 78 years!
This release is dedicated to her!
New features
- #2028: New config
ExtraDetails
supports addition ofDetails
param to all cops to allow extra details on offense to be displayed. (@tansaku) - #2036: New cop
Style/StabbyLambdaParentheses
will find and correct cases where a stabby lambda's paramaters are not wrapped in parentheses. (@hmadison) - #2246:
Style/TrailingUnderscoreVariable
will now register an offense for*_
. (@rrosenblum) - #2246:
Style/TrailingUnderscoreVariable
now has a configuration to remove named underscore variables (Defaulted to false). (@rrosenblum) - #2276: New cop
Performance/FixedSize
will register an offense when callinglength
,size
, orcount
on statically sized objected (strings, symbols, arrays, and hashes). (@rrosenblum) - New cop
Style/NestedModifier
checks for nestedif
,unless
,while
anduntil
modifier statements. (@lumeet) - #2270: Add a new
inherit_gem
configuration to inherit a config file from an installed gem (originally requested in #290). (@jhansche) - Allow
StyleGuide
parameters in local configuration for all cops, so users can add references to custom style guide documents. (@cornelius) UnusedMethodArgument
cop allows configuration to skip keyword arguments. (@apiology)- #2318:
Lint/Debugger
cop now checks forPry.rescue
. (@rrosenblum) - #2277: New cop
Style/FirstArrayElementLineBreak
checks for a line break before the first element in a multi-line array. (@panthomakos) - #2277: New cop
Style/FirstHashElementLineBreak
checks for a line break before the first element in a multi-line hash. (@panthomakos) - #2277: New cop
Style/FirstMethodArgumentLineBreak
checks for a line break before the first argument in a multi-line method call. (@panthomakos) - #2277: New cop
Style/FirstMethodParameterLineBreak
checks for a line break before the first parameter in a multi-line method parameter definition. (@panthomakos) - Add
Rails/PluralizationGrammar
cop, checks for incorrect grammar when using methods like3.day.ago
, when you should write3.days.ago
. (@maxjacobson) - #2347:
Lint/Eval
cop does not warn about "security risk" when eval argument is a string literal without interpolations. (@alexdowad) - #2335:
Style/VariableName
cop checks naming style of method parameters. (@alexdowad) - #2329: New style
braces_for_chaining
forStyle/BlockDelimiters
cop enforces braces on a multi-line block if its return value is being chained with another method. (@panthomakos) Lint/LiteralInCondition
warns if a symbol or dynamic symbol is used as a condition. (@alexdowad)- #2369:
Style/TrailingComma
doesn't add a trailing comma to a multiline method chain which is the only arg to a method call. (@alexdowad) CircularArgumentReference
cop updated to lint for ordinal circular argument references on top of optional keyword arguments. (@maxjacobson)- Added ability to download shared rubocop config files from remote urls. (@ptrippett)
- #1601: Add
IgnoreEmptyMethods
config parameter forLint/UnusedMethodArgument
andIgnoreEmptyBlocks
config parameter forLint/UnusedBlockArgument
cops. (@alexdowad) - #1729:
Style/MethodDefParentheses
supports new 'require_no_parentheses_except_multiline' style. (@alexdowad) - #2173:
Style/AlignParameters
also checks parameter alignment for method definitions. (@alexdowad) - #1825: New
NameWhitelist
configuration parameter forStyle/PredicateName
can be used to suppress errors on known-good predicate names. (@alexdowad) Style/Documentation
recognizes 'Constant = Class.new' as a class definition. (@alexdowad)- #1608: Add new 'align_braces' style for
Style/IndentHash
. (@alexdowad) Style/Next
can autocorrect. (@alexdowad)
Bug Fixes
- #2265: Handle unary
+
inExtraSpacing
cop. (@jonas054) - #2275: Copy default
Exclude
intoExclude
lists in.rubocop_todo.yml
. (@jonas054) Style/IfUnlessModifier
accepts blocks followed by a chained call. (@lumeet)- #2261: Make relative
Exclude
paths in$HOME/.rubocop_todo.yml
be relative to current directory. (@jonas054) - #2286: Handle auto-correction of empty method when
AllowIfMethodIsEmpty
isfalse
inStyle/SingleLineMethods
. (@jonas054) - #2246: Do not register an offense for
Style/TrailingUnderscoreVariable
when the underscore variable is preceeded by a splat variable. (@rrosenblum) - #2292: Results should not be stored in the cache if affected by errors (crashes). (@jonas054)
- #2280: Avoid reporting space between hash literal keys and values in
Style/ExtraSpacing
. (@jonas054) - #2284: Fix result cache being shared between ruby versions. (@miquella)
- #2285: Fix
ConfigurableNaming#class_emitter_method?
error when handling singleton class methods. (@palkan) - #2295: Fix Performance/Detect autocorrect to handle rogue newlines. (@palkan)
- #2294: Do not register an offense in
Performance/StringReplacement
for regex with options. (@rrosenblum) - Fix
Style/UnneededPercentQ
condition for single-quoted literal containing interpolation-like string. (@eagletmt) - #2324: Handle
--only Lint/Syntax
and--except Lint/Syntax
correctly. (@jonas054) - #2317: Handle
case
as an argument correctly inLint/EndAlignment
. (@lumeet) - #2287: Fix auto-correct of lines with only whitespace in
Style/IndentationWidth
. (@lumeet) - #2331: Do not register an offense in
Performance/Size
forcount
with an argument. (@rrosenblum) - Handle a backslash at the end of a line in
Style/SpaceAroundOperators
. (@lumeet) - Don't warn about lack of "leading space" in a =begin/=end comment. (@alexdowad)
- #2307: In
Lint/FormatParameterMismatch
, don't register an offense if either argument to % is not a literal. (@alexdowad) - #2356:
Style/Encoding
will now place the encoding comment on the second line if the first line is a shebang. (@rrosenblum) Style/InitialIndentation
cop doesn't error out when a line begins with an integer literal. (@alexdowad)- #2296: In
Style/DotPosition
, don't "correct" (and break) a method call which has a line comment (or blank line) between the dot and the selector. (@alexdowad) - #2272:
Lint/NonLocalExitFromIterator
does not warn aboutreturn
in a block which is passed toModule#define_method
. (@alexdowad) - #2262: Replace
Rainbow
reference withColorizable#yellow
. (@minustehbare) - #2068: Display warning if
Style/Copyright
is misconfigured. (@alexdowad) - #2321: In
Style/EachWithObject
, don't replace reduce with each_with_object if the accumulator parameter is assigned to in the block. (@alexdowad) - #1981:
Lint/UselessAssignment
doesn't erroneously identify assignments in identical if branches as useless. (@alexdowad) - #2323:
Style/IfUnlessModifier
cop parenthesizes autocorrected code when necessary due to operator precedence, to avoid changing its meaning. (@alexdowad) - #2003: Make
Lint/UnneededDisable
work with--auto-correct
. (@jonas054) - Default RuboCop cache dir moved to per-user folders. (@br3nda)
- #2393:
Style/MethodCallParentheses
doesn't fail onobj.method ||= func()
. (@alexdowad) - #2344: When autocorrecting,
Style/ParallelAssignment
reorders assignment statements, if necessary, to avoid breaking code. (@alexdowad) Style/MultilineOperationAlignment
does not try to align the receiver and selector of a method call if both are on the LHS of an assignment. (@alexdowad)