Apart from the usual myriad of bugfixes, improvements and new cops,
this version introduces a results caching functionality. This
functionality will speed up tremendously consecutive RuboCop runs on
the same codebase.
Another news to share with you - the project now has a crowdfunding
campaign here. If you like RuboCop
you might consider supporting its development.
Enjoy!
New features
- #2143: New cop
Performance/CaseWhenSplat
will identify and rearangecase
when
statements that contain awhen
condition with a splat. (@rrosenblum) - New cop
Lint/DuplicatedKey
checks for duplicated keys in hashes, which Ruby 2.2 warns against. (@sliuu) - #2106: Add
SuspiciousParamNames
option toStyle/OptionHash
. (@wli) - #2193:
Style/Next
supports moreEnumerable
methods. (@rrosenblum) - #2179: Add
--list-target-files
option to CLI, which prints the files which will be inspected. (@maxjacobson) - New cop
Style/MutableConstant
checks for assignment of mutable objects to constants. (@bbatsov) - New cop
Style/RedudantFreeze
checks for usages ofObject#freeze
on immutable objects. (@bbatsov) - #1924: New option
--cache
and configuration parameterAllCops: UseCache
turn result caching on (default) or off. (@jonas054) - #2204: New cop
Style/StringMethods
will check for preferred methodto_sym
overintern
. (@imtayadeway)
Changes
- #1351: Allow class emitter methods in
Style/MethodName
. (@jonas054) - #2126:
Style/RescueModifier
can now auto-correct. (@rrosenblum) - #2109: Allow alignment with a token on the nearest line with same indentation in
Style/ExtraSpacing
. (@jonas054) Lint/EndAlignment
handles thecase
keyword. (@lumeet)- #2146: Add STDIN support. (@caseywebdev)
- #2175: Files that are excluded from a cop (e.g. using the
Exclude:
config option) are no longer being processed by that cop. (@bquorning) Rails/ActionFilter
now handles complete list of methods found in the Rails 4.2 release notes. (@MGerrior)- *2138: Change the offense in
Style/Next
to highlight the condition instead of the iteration. (@rrosenblum) Style/EmptyLineBetweenDefs
now handles class methods as well. (@unmanbearpig)- Improve handling of
super
inStyle/SymbolProc
. (@lumeet) Style/SymbolProc
is applied to methods receiving arguments. (@lumeet)- #1839: Remove Rainbow monkey patching of String which conflicts with other gems like colorize. (@daviddavis)
Style/HashSyntax
is now a bit faster when checking Ruby 1.9 syntax hash keys. (@bquorning)Lint/DeprecatedClassMethods
is now a whole lot faster. (@bquorning)Lint/BlockAlignment
,Style/IndentationWidth
, andStyle/MultilineOperationIndentation
are now quite a bit faster. (@bquorning)
Bug Fixes
- #2123: Fix handing of dynamic widths
Lint/FormatParameterMismatch
. (@edmz) - #2116: Fix named params (using hash)
Lint/FormatParameterMismatch
. (@edmz) - #2135: Ignore
super
andzsuper
nodes inStyle/SymbolProc
. (@bbatsov) - #2165: Fix a NPE in
Style/Alias
. (@bbatsov) - #2168: Fix a NPE in
Rails/TimeZone
. (@bbatsov) - #2169: Fix a NPE in
Rails/Date
. (@bbatsov) - #2105: Fix a warning that was thrown when enabling
Style/OptionHash
. (@wli) - #2107: Fix auto-correct of
Style/ParallelAssignment
for nested expressions. (@rrosenblum) - #2111: Deal with byte order mark in
Style/InitialIndentation
. (@jonas054) - #2113: Handle non-string tokens in
Style/ExtraSpacing
. (@jonas054) - #2129: Handle empty interpolations in
Style/SpaceInsideStringInterpolation
. (@lumeet) - #2119: Do not raise an error in
Style/RescueEnsureAlignment
andStyle/RescueModifier
when processing an excluded file. (@rrosenblum) - #2149: Do not register an offense in
Rails/Date
whenDate#to_time
is called with a time zone argument. (@maxjacobson) - Do not register a
Rails/TimeZone
offense when using Time.new safely. (@maxjacobson) - #2124: Fix bug in
Style/EmptyLineBetweenDefs
when there are only comments between method definitions. (@lumeet) - #2154:
Performance/StringReplacement
can auto-correct replacements with backslash in them. (@rrosenblum) - #2009: Fix bug in
RuboCop::ConfigLoader.load_file
whensafe_yaml
is required. (@eitoball) - #2155: Configuration
EndAlignment: AlignWith: variable
only applies when the operands of=
are on the same line. (@jonas054) - Fix bug in
Style/IndentationWidth
whenrescue
orensure
is preceded by an empty body. (@lumeet) - #2183: Fix bug in
Style/BlockDelimiters
when auto-correcting adjacent braces. (@lumeet) - #2199: Make
rubocop
exit with error when there are onlyLint/UnneededDisable
offenses. (@jonas054) - Fix handling of empty parentheses when auto-correcting in
Style/SymbolProc
. (@lumeet)