Nothing ground-breaking this time around, but the release is pretty exciting non-the-less.
It packs a whole new category of cops (Performance
) and a bunch of new Rails cops.
A lot of the existing cops got new customization options and we squashed a ton of bugs.
Thanks to everyone who contributed to this release!
New features
- #1600: Add
line_count_based
andsemantic
styles to theBlockDelimiters
(formerlyBlocks
) cop. (@clowder, @mudge) - #1712: Set
Offense#corrected?
totrue
,false
, ornil
when it was, wasn't, or can't be auto-corrected, respectively. (@vassilevsky) - #1669: Add command-line switch
--display-style-guide
. (@marxarelli) - #1405: Add Rails TimeZone and Date cops. (@palkan)
- #1641: Add ruby19_no_mixed_keys style to
HashStyle
cop. (@iainbeeston) - #1604: Add
IgnoreClassMethods
option toTrivialAccessors
cop. (@bbatsov) - #1651: The
Style/SpaceAroundOperators
cop now also detects extra spaces around operators. A list of operators that may be surrounded by multiple spaces is configurable. (@bquorning) - Add auto-correct to
Encoding
cop. (@rrosenblum) - #1621:
TrailingComma
has a new styleconsistent_comma
. (@tamird) - #1611: Add
empty
,nil
, andboth
SupportedStyles
toEmptyElse
cop. Default isboth
. (@rrosenblum) - #1611: Add new
MissingElse
cop. Default is to have this cop be disabled. (@rrosenblum) - #1602: Add support for
# :nodoc
inDocumentation
. (@lumeet) - #1437: Modify
HashSyntax
cop to allow the use of hash rockets for hashes that have symbol values when using ruby19 syntax. (@rrosenblum) - New cop
Style/SymbolLiteral
makes sure you're not using the string within symbol syntax unless it's needed. (@bbatsov) - #1657: Autocorrect can be turned off on a specific cop via the configuration. (@jdoconnor)
- New cop
Style/AutoResourceCleanup
suggests the use of block taking versions of methods that do resource cleanup. (@bbatsov) - #1275:
WhileUntilModifier
cop does auto-correction. (@lumeet) - New cop
Performance/ReverseEach
to convertreverse.each
toreverse_each
. (@rrosenblum) - #1281:
IfUnlessModifier
cop does auto-correction. (@lumeet) - New cop
Performance/Detect
to detect usage ofselect.first
,select.last
,find_all.first
, andfind_all.last
and convert them to usedetect
instead. (@palkan, @rrosenblum) - #1728: New cop
NonLocalExitFromIterator
checks for misusedreturn
in block. (@ypresto) - New cop
Performance/Size
to convert calls tocount
onArray
andHash
tosize
. (@rrosenblum) - New cop
Performance/Sample
to convert usages ofshuffle.first
,shuffle.last
, andshuffle[Fixnum]
tosample
. (@rrosenblum) - New cop
Performance/FlatMap
to convertEnumerable#map...Array#flatten
andEnumerable#collect...Array#flatten
toEnumerable#flat_map
. (@rrosenblum) - #1144: New cop
ClosingParenthesisIndentation
checks the indentation of hanging closing parentheses. (@jonas054) - New Rails cop
FindBy
identifies usages ofwhere.first
andwhere.take
. (@bbatsov) - New Rails cop
FindEach
identifies usages ofall.each
. (@bbatsov) - #1342:
IndentationConsistency
is now configurable with the stylesnormal
andrails
. (@jonas054)
Bugs fixed
- #1705: Fix crash when reporting offenses of
MissingElse
cop. (@gerry3) - #1659: Fix stack overflow with JRuby and Windows 8, during initial config validation. (@pimterry)
- #1694: Ignore methods with a
blockarg
inTrivialAccessors
. (@bbatsov) - #1617: Always read the html output template using utf-8. (@bbatsov)
- #1684: Ignore symbol keys like
:"string"
inHashSyntax
. (@bbatsov) - Handle explicit
begin
blocks inLint/Void
. (@bbatsov) - Handle symbols in
Lint/Void
. (@bbatsov) - #1695: Fix bug with
--auto-gen-config
andSpaceInsideBlockBraces
. (@meganemura) - Correct issues with whitespace around multi-line lambda arguments. (@zvkemp)
- #1579: Fix handling of similar-looking blocks in
BlockAlignment
. (@lumeet) - #1676: Fix auto-correct in
Lambda
when a new multi-line lambda is used as an argument. (@lumeet) - #1656: Fix bug that would include hidden directories implicitly. (@jonas054)
- #1728: Fix bug in
LiteralInInterpolation
andAssignmentInCondition
. (@ypresto) - #1735: Handle trailing space in
LineEndConcatenation
autocorrect. (@jonas054) - #1750: Escape offending code lines output by the HTML formatter in case they contain markup. (@jonas054)
- #1541: No inspection of text that follows
__END__
. (@jonas054) - Fix comment detection in
Style/Documentation
. (@lumeet) - #1637: Fix handling of
binding
calls inUnusedBlockArgument
andUnusedMethodArgument
. (@lumeet)
Changes
- #1397:
UnneededPercentX
renamed toCommandLiteral
. The cop can be configured to enforce using either%x
or backticks around command literals, or using%x
around multi-line commands and backticks around single-line commands. The cop ignores heredoc commands. (@bquorning) - #1020: Removed the
MaxSlashes
configuration option forRegexpLiteral
. Instead, the cop can be configured to enforce using either%r
or slashes around regular expressions, or using%r
around multi-line regexes and slashes around single-line regexes. (@bquorning) - #1734: The default exclusion of hidden directories has been optimized for speed. (@jonas054)
- #1673:
Style/TrivialAccessors
now requires matching names by default. (@bbatsov)