github rubocop/rubocop v0.30.0
RuboCop 0.30.0

latest releases: v1.68.0, v1.67.0, v1.66.1...
9 years ago

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 and semantic styles to the BlockDelimiters (formerly Blocks) cop. (@clowder, @mudge)
  • #1712: Set Offense#corrected? to true, false, or nil 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 to TrivialAccessors 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 style consistent_comma. (@tamird)
  • #1611: Add empty, nil, and both SupportedStyles to EmptyElse cop. Default is both. (@rrosenblum)
  • #1611: Add new MissingElse cop. Default is to have this cop be disabled. (@rrosenblum)
  • #1602: Add support for # :nodoc in Documentation. (@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 convert reverse.each to reverse_each. (@rrosenblum)
  • #1281: IfUnlessModifier cop does auto-correction. (@lumeet)
  • New cop Performance/Detect to detect usage of select.first, select.last, find_all.first, and find_all.last and convert them to use detect instead. (@palkan, @rrosenblum)
  • #1728: New cop NonLocalExitFromIterator checks for misused return in block. (@ypresto)
  • New cop Performance/Size to convert calls to count on Array and Hash to size. (@rrosenblum)
  • New cop Performance/Sample to convert usages of shuffle.first, shuffle.last, and shuffle[Fixnum] to sample. (@rrosenblum)
  • New cop Performance/FlatMap to convert Enumerable#map...Array#flatten and Enumerable#collect...Array#flatten to Enumerable#flat_map. (@rrosenblum)
  • #1144: New cop ClosingParenthesisIndentation checks the indentation of hanging closing parentheses. (@jonas054)
  • New Rails cop FindBy identifies usages of where.first and where.take. (@bbatsov)
  • New Rails cop FindEach identifies usages of all.each. (@bbatsov)
  • #1342: IndentationConsistency is now configurable with the styles normal and rails. (@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 in TrivialAccessors. (@bbatsov)
  • #1617: Always read the html output template using utf-8. (@bbatsov)
  • #1684: Ignore symbol keys like :"string" in HashSyntax. (@bbatsov)
  • Handle explicit begin blocks in Lint/Void. (@bbatsov)
  • Handle symbols in Lint/Void. (@bbatsov)
  • #1695: Fix bug with --auto-gen-config and SpaceInsideBlockBraces. (@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 and AssignmentInCondition. (@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 in UnusedBlockArgument and UnusedMethodArgument. (@lumeet)

Changes

  • #1397: UnneededPercentX renamed to CommandLiteral. 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 for RegexpLiteral. 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)

Don't miss a new rubocop release

NewReleases is sending notifications on new releases.