There aren't many exciting new features this time around - our focus in 0.20 has been fixing most of the problems we introduced in 0.19. Apart from that we've added a few new cops and implemented auto-correct for a bunch of the existing cops.
You'll also notice that the messages produced by most formatters a bit more colorful (and hopefully more readable as well).
You should also note that AllCops/Includes
and AllCops/Excludes
have been renamed, so you'll have to update your config files accordingly.
Below is the list of all the gory details. Enjoy!
New features
- New cop
GuardClause
checks for conditionals that can be replaced by guard clauses. (@bbatsov) - New cop
EmptyInterpolation
checks for empty interpolation in double-quoted strings. (@bbatsov) - #899: Make
LineEndConcatenation
cop<<
aware. (@mockdeep) - #896: New option
--fail-level
changes minimum severity for exit with error code. (@hiroponz) - #893: New option
--force-exclusion
forces excluding files specified in the configurationExclude
even if they are explicitly passed as arguments. (@yujinakayama) VariableInterpolation
cop does auto-correction. (@bbatsov)Not
cop does auto-correction. (@bbatsov)ClassMethods
cop does auto-correction. (@bbatsov)StringConversionInInterpolation
cop does auto-correction. (@bbatsov)NilComparison
cop does auto-correction. (@bbatsov)NonNilComparison
cop does auto-correction. (@bbatsov)NegatedIf
cop does auto-correction. (@bbatsov)NegatedWhile
cop does auto-correction. (@bbatsov)- New lint cop
SpaceBeforeFirstArg
checks for space between the method name and the first argument in method calls without parentheses. (@jonas054) - New style cop
SingleSpaceBeforeFirstArg
checks that no more than one space is used between the method name and the first argument in method calls without parentheses. (@jonas054) - New formatter
disabled_lines
displays cops and line ranges disabled by inline comments. (@fshowalter) - New cop
UselessAccessModifiers
checks for access modifiers that have no effect. (@fshowalter)
Changes
- #913:
FileName
accepts multiple extensions. (@tamird) AllCops/Excludes
andAllCops/Includes
were renamed toAllCops/Exclude
andAllCops/Include
for consistency with standard cop params. (@bbatsov)- Extract
NonNilCheck
cop fromNilComparison
. (@bbatsov) - Renamed
FavorJoin
toArrayJoin
. (@bbatsov) - Renamed
FavorUnlessOverNegatedIf
toNegatedIf
. (@bbatsov) - Renamed
FavorUntilOverNegatedWhile
toNegatedWhile
. (@bbatsov) - Renamed
HashMethods
toDeprecatedHashMethods
. (@bbatsov) - Renamed
ReadAttribute
toReadWriteAttribute
and extended it to check for uses ofwrite_attribute
. (@bbatsov) - Add experimental support for Ruby 2.2 (development version) by falling back to Ruby 2.1 parser. (@yujinakayama)
Bugs fixed
- #926: Fixed
BlockNesting
not auto-generating correctly. (@tmorris-fiksu) - #904: Fixed a NPE in
LiteralInInterpolation
. (@bbatsov) - #904: Fixed a NPE in
StringConversionInInterpolation
. (@bbatsov) - #892: Make sure
Include
andExclude
paths in a.rubocop.yml
are interpreted as relative to the directory of that file. (@jonas054) - #906: Fixed a false positive in
LiteralInInterpolation
. (@bbatsov) - #909: Handle properly multiple
rescue
clauses inSignalException
. (@bbatsov) - #876: Do a deep merge of hashes when overriding default configuration in a
.rubocop.yml
file. (@jonas054) - #912: Fix a false positive in
LineEndConcatenation
for%
string literals. (@bbatsov) - #912: Handle top-level constant resolution in
DeprecatedClassMethods
(e.g.::File.exists?
). (@bbatsov) - #914: Fixed rdoc error during gem installation. (@bbatsov)
- The
--only
option now enables the given cop in case it is disabled in configuration. (@jonas054) - Fix path resolution so that the default exclusion of
vendor
directories works. (@jonas054) - #908: Fixed hanging while auto correct for
SpaceAfterComma
andSpaceInsideBrackets
. (@hiroponz) - #919: Don't avoid auto-correction in
HashSyntax
when there is missing space around operator. (@jonas054) - Fixed handling of floats in
NumericLiterals
. (@bbatsov) - #927: Let
--auto-gen-config
overwrite an existingrubocop-todo.yml
file instead of asking the user to remove it. (@jonas054) - #936: Allow
_other
as well asother
inOpMethod
. (@bbatsov)