This is the biggest RuboCop release we've done in a while. The highlights include
about a dozen new cops, more cop configuration options, improved auto-correct and so many bugfixes.
You'll might note that we changed the use of offence
with offense
. This was done to keep the spelling
in our code consistent. Hopefully this won't cause anyone problems, but we're obliged to mention it as
the Offence
class itself got renamed.
Below is the list of all the gory details. Enjoy!
RuboCop 0.19.0
New features
- New cop
FileName
makes sure that source files have snake_case names. (@bbatsov) - New cop
DeprecatedClassMethods
checks for deprecated class methods. (@bbatsov) - New cop
StringConversionInInterpolation
checks for redundantObject#to_s
in string interpolation. (@bbatsov) - New cop
LiteralInInterpolation
checks for interpolated string literals. (@bbatsov) - New cop
SelfAssignment
checks for places where the self-assignment shorthand should have been used. (@bbatsov) - New cop
DoubleNegation
checks for uses of!!
. (@bbatsov) - New cop
PercentLiteralDelimiters
enforces consistent usage of%
-literal delimiters. (@hannestyden) - New Rails cop
ActionFilter
enforces the use of_filter
or_action
action filter methods. (@bbatsov) - New Rails cop
ScopeArgs
makes sure you invoke thescope
method properly. (@bbatsov) - Add
with_fixed_indentation
style toAlignParameters
cop. (@hannestyden) - Add
IgnoreLastArgumentHash
option toAlignHash
cop. (@hannestyden) - #743:
SingleLineMethods
cop does auto-correction. (@jonas054) - #743:
Semicolon
cop does auto-correction. (@jonas054) - #743:
EmptyLineBetweenDefs
cop does auto-correction. (@jonas054) - #743:
IndentationWidth
cop does auto-correction. (@jonas054) - #743:
IndentationConsistency
cop does auto-correction. (@jonas054) - #809: New formatter
fuubar
displays a progress bar and shows details of offenses as soon as they are detected. (@yujinakayama) - #797: New cop
IndentHash
checks the indentation of the first key in multi-line hash literals. (@jonas054) - #797: New cop
IndentArray
checks the indentation of the first element in multi-line array literals. (@jonas054) - #806: Now excludes files in
vendor/**
by default. (@jeremyolliver) - #795:
IfUnlessModifier
andWhileUntilModifier
supportsMaxLineLength
, which is independent ofLineLength
parameterMax
. (@agrimm) - #868: New cop
ClassAndModuleChildren
checks the style of children definitions at classes and modules: nested / compact. (@geniou)
Changes
- #793: Add printing total count when
rubocop --format offences
. (@ma2gedev) - Remove
Ignore
param from the RailsOutput
cop. The standardExclude/Include
should be used instead. (@bbatsov) - Renamed
FavorSprintf
toFormatString
and made it configurable. (@bbatsov) - Renamed
Offence
toOffense
. (@bbatsov) - Use
offense
in all messages instead ofoffence
. (@bbatsov) - For indentation of
if
/unless
/while
/until
bodies when the result is assigned to a variable, instead of supporting two styles simultaneously,IndentationWidth
now supports one style of indentation at a time, specified byEndAlignment
/AlignWith
. (@jonas054) - Renamed
Style
param ofDotPosition
cop toEnforcedStyle
. (@bbatsov) - Add
length
value to locations of offense in JSON formatter. (@yujinakayama) SpaceAroundBlockBraces
cop replaced bySpaceBeforeBlockBraces
andSpaceInsideBlockBraces
. (@jonas054)SpaceAroundEqualsInParameterDefault
cop is now configurable with theEnforcedStyle
option. (@jonas054)
Bugs fixed
- #790: Fix auto-correction interference problem between
MethodDefParentheses
and other cops. (@jonas054) - #794: Fix handling of modifier keywords with required parentheses in
ParenthesesAroundCondition
. (@bbatsov) - #804: Fix a false positive with operator assignments in a loop (including
begin..rescue..end
withretry
) inUselessAssignment
. (@yujinakayama) - #815: Fix a false positive for heredocs with blank lines in them in
EmptyLines
. (@bbatsov) - Auto-correction is now more robust and less likely to die because of
RangeError
or "clobbering". (@jonas054) - Offenses always reported in order of position in file, also during
--auto-correct
runs. (@jonas054) - Fix problem with
[Corrected]
tag sometimes missing in output from--auto-correct
runs. (@jonas054) - Fix message from
EndAlignment
cop whenAlignWith
iskeyword
. (@jonas054) - Handle
case
conditions inLiteralInCondition
. (@bbatsov) - #822: Fix a false positive in
DotPosition
when enforced style is set totrailing
. (@bbatsov) - Handle properly dynamic strings in
LineEndConcatenation
. (@bbatsov) - #832: Fix auto-correction interference problem between
BracesAroundHashParameters
andSpaceInsideHashLiteralBraces
. (@jonas054) - Fix bug in auto-correction of alignment so that only space can be removed. (@jonas054)
- Fix bug in
IndentationWidth
auto-correction so it doesn't correct things thatIndentationConsistency
should correct. (@jonas054) - #847: Fix bug in
RegexpLiteral
concerning--auto-gen-config
. (@jonas054) - #848: Fix bug in
--show-cops
that made it print the default configuration rather than the current configuration. (@jonas054) - #862: Fix a bug where single line
rubocop:disable
comments with indentations were treated as multiline cop disabling comments. (@yujinakayama) - Fix a bug where
rubocop:disable
comments with a cop name includingall
(e.g.MethodCallParentheses
) were disabling all cops. (@yujinakayama) - Fix a bug where string and regexp literals including
# rubocop:disable
were confused with real comments. (@yujinakayama)