github rubocop/rubocop v0.19.0
RuboCop 0.19.0

latest releases: v1.63.3, v1.63.2, v1.63.1...
10 years ago

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 redundant Object#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 the scope method properly. (@bbatsov)
  • Add with_fixed_indentation style to AlignParameters cop. (@hannestyden)
  • Add IgnoreLastArgumentHash option to AlignHash 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 and WhileUntilModifier supports MaxLineLength, which is independent of LineLength parameter Max. (@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 Rails Output cop. The standard Exclude/Include should be used instead. (@bbatsov)
  • Renamed FavorSprintf to FormatString and made it configurable. (@bbatsov)
  • Renamed Offence to Offense. (@bbatsov)
  • Use offense in all messages instead of offence. (@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 by EndAlignment/AlignWith. (@jonas054)
  • Renamed Style param of DotPosition cop to EnforcedStyle. (@bbatsov)
  • Add length value to locations of offense in JSON formatter. (@yujinakayama)
  • SpaceAroundBlockBraces cop replaced by SpaceBeforeBlockBraces and SpaceInsideBlockBraces. (@jonas054)
  • SpaceAroundEqualsInParameterDefault cop is now configurable with the EnforcedStyle 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 with retry) in UselessAssignment. (@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 when AlignWith is keyword. (@jonas054)
  • Handle case conditions in LiteralInCondition. (@bbatsov)
  • #822: Fix a false positive in DotPosition when enforced style is set to trailing. (@bbatsov)
  • Handle properly dynamic strings in LineEndConcatenation. (@bbatsov)
  • #832: Fix auto-correction interference problem between BracesAroundHashParameters and SpaceInsideHashLiteralBraces. (@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 that IndentationConsistency 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 including all (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)

Don't miss a new rubocop release

NewReleases is sending notifications on new releases.