Releases: rubocop/rubocop
RuboCop 0.26.1
RuboCop 0.26.1 is a bugfix-only release. Below is a list of the bugs we've fixed since 0.26.0:
Bugs fixed
- #1326: Fix problem in
SpaceInsideParens
with detecting space inside parentheses used for grouping expressions. (@jonas054) - #1335: Restrict URI schemes permitted by
LineLength
whenAllowURI
is enabled. (@smangelsdorf) - #1339: Handle
eql?
andequal?
inOpMethod
. (@bbatsov) - #1340: Fix crash in
Style/SymbolProc
cop when the block calls a method with no explicit receiver. (@smangelsdorf)
RuboCop 0.26.0
Nothing particularly exciting this time around. The new release comes
with lots of bug fixes, more auto-corrections and several new cops.
Note that the Style/Encoding
cop is now disabled by default. See
#1304 for the rationale behind this change.
Below is the list of all the gory details. Enjoy!
New features
- New formatter
HTMLFormatter
generates a html file with a list of files with offences in them. (@SkuliOskarsson) - New cop
SpaceInsideRangeLiteral
checks for spaces around..
and...
in range literals. (@bbatsov) - New cop
InfiniteLoop
checks for places whereKernel#loop
should have been used. (@bbatsov) - New cop
SymbolProc
checks for places where a symbol can be used as proc instead of a block. (@bbatsov) UselessAssignment
cop now suggests a variable name for possible typos if there's a variable-ish identifier similar to the unused variable name in the same scope. (@yujinakayama)PredicateName
cop now has separate configurations for prefices that denote predicate method names and predicate prefices that should be removed. (@bbatsov)- #1272:
Tab
cop does auto-correction. (@yous) - #1274:
MultilineIfThen
cop does auto-correction. (@bbatsov) - #1279:
DotPosition
cop does auto-correction. (@yous) - #1277:
SpaceBeforeFirstArg
cop does auto-correction. (@yous) - #1310: Handle
module_function
inStyle/AccessModifierIndentation
andStyle/EmptyLinesAroundAccessModifier
. (@bbatsov)
Changes
- #1289: Use utf-8 as default encoding for inspected files. (@jonas054)
- #1304:
Style/Encoding
is no longer a no-op on Ruby 2.x. It's also disabled by default, as projects not supporting 1.9 don't need to run it. (@bbatsov)
Bugs fixed
- #1263: Do not report
%W
literals with special escaped characters inUnneededCapitalW
. (@jonas054) - #1286: Fix a false positive in
VariableName
. (@bbatsov) - #1211: Fix false negative in
UselessAssignment
when there's a reference for the variable in an exclusive branch. (@yujinakayama) - #1307: Fix auto-correction of
RedundantBegin
cop deletes new line. (@yous) - #1283: Fix auto-correction of indented expressions in
PercentLiteralDelimiters
. (@jonas054) - #1315:
BracesAroundHashParameters
auto-correction removes whitespace around content inside braces. (@jspanjers) - #1313: Fix a false positive in
AndOr
when enforced style isconditionals
. (@bbatsov) - Handle post-conditional
while
anduntil
inAndOr
when enforced style isconditionals
. (@yujinakayama) - #1319: Fix a false positive in
FormatString
. (@bbatsov) - #1287: Allow missing blank line for EmptyLinesAroundAccessModifier if next line closes a block. (@sch1zo)
RuboCop 0.25.0
This release comes with lots of bug fixes and several new cops (that will likely need bugfixes in the next release :-)).
The most notable change in 0.25 is the addition of the Metrics
namespace. Several Style
cops have been moved there
(e.g. ClassLength
, MethodLength
, etc).
This release also marks the end of us supporting Ruby 1.9.2 - now Ruby 1.9.3+ is required.
Below is the list of all the gory details. Enjoy!
New features
- #1259: Allow AndOr cop to autocorrect by adding method call parenthesis. (@vrthra)
- #1232: Add EnforcedStyle option to cop
AndOr
to restrict it to conditionals. (@vrthra) - #835: New cop
PercentQLiterals
checks if use of%Q
and%q
matches configuration. (@jonas054) - #835: New cop
BarePercentLiterals
checks if usage of%()
or%Q()
matches configuration. (@jonas054) - #1079: New cop
MultilineBlockLayout
checks if a multiline block has an extpression on the same line as the start of the block. (@barunio) - #1217:
Style::EmptyLinesAroundAccessModifier
cop does auto-correction. (@tamird) - #1220: New cop
PerceivedComplexity
is similar toCyclomaticComplexity
, but reports when methods have a high complexity for a human reader. (@jonas054) Debugger
cop now checks forbinding.pry_remote
. (@yous)- #1238: Add
MinBodyLength
option toNext
cop. (@bbatsov) - #1241:
TrailingComma
cop does auto-correction. (@yous) - #1078: New cop
BlockEndNewline
checks if the end statement of a multiline block is on its own line. (@barunio) - #1078:
BlockAlignment
cop does auto-correction. (@barunio)
Changes
- #1220: New namespace
Metrics
created and someStyle
cops moved there. (@jonas054) - Drop support for Ruby 1.9.2 in accordance with the end of the security maintenance extension. (@yujinakayama)
Bugs fixed
- #1251: Fix
PercentLiteralDelimiters
auto-correct indentation error. (@hannestyden) - #1197: Fix false positive for new lambda syntax in
SpaceInsideBlockBraces
. (@jonas054) - #1201: Fix error at anonymous keyword splat arguments in some variable cops. (@yujinakayama)
- Fix false positive in
UnneededPercentQ
for/%Q(something)/
. (@jonas054) - Fix
SpacesInsideBrackets
forHash#[]
calls with spaces after left bracket. (@mcls) - #1210: Fix false positive in
UnneededPercentQ
for%Q(\t")
. (@jonas054) - Fix false positive in
UnneededPercentQ
for heredoc strings with%q
/%Q
. (@jonas054) - #1214: Don't destroy code in
AlignHash
autocorrect. (@jonas054) - #1219: Don't report bad alignment for
end
or}
inBlockAlignment
if it doesn't begin its line. (@jonas054) - #1227: Don't permanently change yamler as it can affect other apps. (@jonas054)
- #1184: Fix a false positive in
Output
cop. (@bbatsov) - #1256: Ignore block-pass in
TrailingComma
. (@tamird) - #1255: Compare without context in
AutocorrectUnlessChangingAST
. (@jonas054) - #1262: Handle regexp and backtick literals in
VariableInterpolation
. (@bbatsov)
RuboCop 0.24.1
RuboCop 0.24.1 is a bugfix-only release. Below is a list of the bugs we've fixed since 0.24.0:
Bugs fixed
- #1174: Fix
--auto-correct
crash inAlignParameters
. (@jonas054) - #1176: Fix
--auto-correct
crash inIndentationWidth
. (@jonas054) - #1177: Avoid suggesting underscore-prefixed name for unused keyword arguments and auto-correcting in that way. (@yujinakayama)
- #1157: Validate
--only
arguments later when all cop names are known. (@jonas054) - #1188, #1190: Fix crash in
LineLength
cop whenAllowURI
option is enabled. (@yujinakayama) - #1191: Fix crash on empty body branches in a loop in
Next
cop. (@yujinakayama)
RuboCop 0.24.0
This release is mostly about fixing bugs, but it also features a few new cops.
Below is the list of all the gory details. Enjoy!
New features
- #639: Support square bracket setters in
UselessSetterCall
. (@yujinakayama) - #835:
UnneededCapitalW
cop does auto-correction. (@sfeldon) - #1092: New cop
DefEndAlignment
takes over responsibility for checkng alignment of method definitionend
s fromEndAlignment
, and is configurable. (@jonas054) - #1145: New cop
ClassCheck
enforces consistent use ofis_a?
orkind_of?
. (@bbatsov) - #1161: New cop
SpaceBeforeComma
detects spaces before a comma. (@agrimm) - #1161: New cop
SpaceBeforeSemicolon
detects spaces before a semicolon. (@agrimm) - #835: New cop
UnneededPercentQ
checks for usage of the%q
/%Q
syntax when''
or""
would do. (@jonas054) - #977: Add
AllowURI
option (enabled by default) toLineLength
cop. (@yujinakayama)
Changes
- Unused block local variables (
obj.each { |arg; this| }
) are now handled byUnusedBlockArgument
cop instead ofUselessAssignment
cop. (@yujinakayama) - #1141: Clarify in the message from
TrailingComma
that a trailing comma is never allowed for lists where some items share a line. (@jonas054)
Bugs fixed
- #1133: Handle
reduce/inject
with no arguments inEachWithObject
. (@bbatsov) - #1152: Handle
while/until
with no body inNext
. (@tamird) - Fix a false positive in
UselessSetterCall
for setter call on a local variable that contains a non-local object. (@yujinakayama) - #1158: Fix auto-correction of floating-point numbers. (@bbatsov)
- #1159: Fix checking of
begin
..end
structures, blocks, and parenthesized expressions inIndentationWidth
. (@jonas054) - #1159: More rigid conditions for when
attr
is considered an offense. (@jonas054) - #1167: Fix handling of parameters spanning multiple lines in
TrailingComma
. (@jonas054) - #1169: Fix handling of ternary op conditions in
ParenthesesAroundCondition
. (@bbatsov) - #1147: WordArray checks arrays with special characters. (@camilleldn)
- Fix a false positive against
return
in a loop inNext
cop. (@yujinakayama) - #1165: Support
rescue
/else
/ensure
bodies inIndentationWidth
. (@jonas054) - Fix false positive for aligned list of values after
when
inIndentationWidth
. (@jonas054)
RuboCop 0.23.0
This release is mostly about fixing bugs, but it also features a few prominent changes:
- Cops are now namespace aware, which would it make it simpler to write RuboCop extensions without
worrying about name collisions (e.g. you can now haveStyle/Filename
andRSpec/Filename
cops). - There's now logic which prevents auto-corrections from generated invalid Ruby code.
- The
Rubocop
module was renamed toRuboCop
, which will affect packages relying on RuboCop's public API.
Below is the list of all the gory details. Enjoy!
New features
- #1117:
BlockComments
cop does auto-correction. (@jonas054) - #1124:
TrivialAccessors
cop auto-corrects class-level accessors. (@ggilder) - #1062: New cop
InlineComment
checks for inline comments. (@salbertson) - #1118: Add checking and auto-correction of right brackets in
IndentArray
andIndentHash
. (@jonas054)
Changes
- #1097: Add optional namespace prefix to cop names:
Style/LineLength
instead ofLineLength
in config files,--only
argument,--show-cops
output, and# rubocop:disable
. (@jonas054) - #1075: More strict limits on when to require trailing comma. (@jonas054)
- Renamed
Rubocop
module toRuboCop
. (@bbatsov)
Bugs fixed
- #1126: Fix
--auto-gen-config
bug withRegexpLiteral
where only the last file's results would be used. (@ggilder) - #1104: Fix
EachWithObject
with modifier if as body. (@geniou) - #1106: Fix
EachWithObject
with single method call as body. (@geniou) - Avoid the warning about ignoring syck YAML engine from JRuby. (@jonas054)
- #1111: Fix problem in
EndOfLine
with reading non-UTF-8 encoded files. (@jonas054) - #1115: Fix
Next
to ignore super nodes. (@geniou) - #1117: Don't auto-correct indentation in scopes that contain block comments (
=begin
..=end
). (@jonas054) - #1123: Support setter calls in safe assignment in
ParenthesesAroundCondition
. (@jonas054) - #1090: Correct handling of documentation vs annotation comment. (@jonas054)
- #1118: Never write invalid ruby to a file in auto-correct. (@jonas054)
- #1120: Don't change indentation of heredoc strings in auto-correct. (@jonas054)
- #1109: Handle conditions with modifier ops in them in
ParenthesesAroundCondition
. (@bbatsov)
RuboCop 0.22.0
This release brings a few new cops, extended auto-correction support and plenty of bug fixes.
Below is the list of all the gory details. Enjoy!
New features
- #974: New cop
CommentIndentation
checks indentation of comments. (@jonas054) - Add new cop
EachWithObject
to prefereach_with_object
overinject
orreduce
. (@geniou) - #1010: New Cop
Next
check for conditions at the end of an interation and propose to usenext
instead. (@geniou) - The
GuardClause
cop now also looks for unless and it is configurable how many lines the body of an if / unless needs to have to not be ignored. (@geniou) - #835: New cop
UnneededPercentX
checks for%x
when backquotes would do. (@jonas054) - Add auto-correct to
UnusedBlockArgument
andUnusedMethodArgument
cops. (@hannestyden) - #1074: New cop
SpaceBeforeComment
checks for missing space between code and a comment on the same line. (@jonas054) - #1089: New option
-F
/--fail-fast
inspects files in modification time order and stop after the first file with offenses. (@jonas054)
Changes
NonNilCheck
offense reporting and autocorrect are configurable to include semantic changes. (@hannestyden)- The parameters
AllCops/Excludes
andAllCops/Includes
with finals
only give a warning and don't haltrubocop
execution. (@jonas054) - The
GuardClause
cop is no longer irgnoring a one-line body by default - see configuration. (@geniou) - #1050: Rename
rubocop-todo.yml
file to.rubocop_todo.yml
. (@geniou) - #1064: Adjust default max line length to 80. (@bbatsov)
Bugs fixed
- Allow assignment in
AlignParameters
cop. (@tommeier) - Fix
Void
andSpaceAroundOperators
for short call syntaxlambda.()
. (@biinari) - Fix
Delegate
for delegation with assignment or constant. (@geniou) - #1032: Avoid duplicate reporting when code moves around due to
--auto-correct
. (@jonas054) - #1036: Handle strings like
__FILE__
inLineEndConcatenation
. (@bbatsov) - #1006: Fix LineEndConcatenation to handle chained concatenations. (@barunio)
- #1066: Fix auto-correct for
NegatedIf
when the condition has parentheses around it. (@jonas054) - Fix
AlignParameters
with_fixed_indentation
for multi-line method calls. (@molawson) - Fix problem that appears in some installations when reading empty YAML files. (@jonas054)
- #1022: A Cop will no longer auto-correct a file that's excluded through an
Exclude
setting in the cop's configuration. (@jonas054) - Fix paths in
Exclude
config section not being recognized on Windows. (@wndhydrnt) - #1094: Fix ClassAndModuleChildren for classes with a single method. (@geniou)
RuboCop 0.21.0
This release brings a few new cops and extended auto-correction support. The most significant
change is that we've changed the syntax for excluding/including to be closer to that of shell globbing.
Below is the list of all the gory details. Enjoy!
New features
- #835: New cop
UnneededCapitalW
checks for%W
when interpolation not necessary and%w
would do. (@sfeldon) - #934: New cop
UnderscorePrefixedVariableName
checks for_
-prefixed variables that are actually used. (@yujinakayama) - #934: New cop
UnusedMethodArgument
checks for unused method arguments. (@yujinakayama) - #934: New cop
UnusedBlockArgument
checks for unused block arguments. (@yujinakayama) - #964:
RedundantBegin
cop does auto-correction. (@tamird) - #966:
RescueException
cop does auto-correction. (@tamird) - #967:
TrivialAccessors
cop does auto-correction. (@tamird) - #963: Add
AllowDSLWriters
options toTrivialAccessors
. (@tamird) - #969: Let the
Debugger
cop check for forgotten calls to byebug. (@bquorning) - #971: Configuration format deprecation warnings include the path to the problematic config file. (@bcobb)
- #490: Add EnforcedStyle config option to TrailingBlankLines. (@jonas054)
- Add
auto_correct
task to Rake integration. (@irrationalfab) - #986: The
--only
option can take a comma-separated list of cops. (@jonas054) - New Rails cop
Delegate
that checks for delegations that could be replaced by thedelegate
method. (@geniou) - Add configuration to
Encoding
cop to only enforce encoding comment if there are non ASCII characters. (@geniou)
Changes
- Removed
FinalNewline
cop as its check is now performed byTrailingBlankLines
. (@jonas054) - #1011: Pattern matching with
Dir#[]
for config parameters added. (@jonas054)
Bugs fixed
- Update description on
LineEndConcatenation
cop. (@mockdeep) - #978: Fix regression in
IndentationWidth
handling method calls. (@tamird) - #976: Fix
EndAlignment
not handling element assignment correctly. (@tamird) - #976: Fix
IndentationWidth
not handling element assignment correctly. (@tamird) - #800: Do not report
[Corrected]
in--auto-correct
mode if correction wasn't done. (@jonas054) - #968: Fix bug when running Rubocop with
-c .rubocop.yml
. (@bquorning) - #975: Fix infinite correction in
IndentationWidth
. (@jonas054) - #986: When
--lint
is used together with--only
, all lint cops are run in addition to the given cops. (@jonas054) - #997: Fix handling of file paths for matching against
Exclude
property whenrubocop .
is called. (@jonas054) - #1000: Support modifier (e.g.,
private
) anddef
on the same line (Ruby >= 2.1) inIndentationWidth
. (@jonas054) - #1001: Fix
--auto-gen-config
logic forRegexpLiteral
. (@jonas054) - #993: Do not report any offenses for the contents of an empty file. (@jonas054)
- #1016: Fix a false positive in
ConditionPosition
regarding statement modifiers. (@bbatsov) - #1014: Fix handling of strings nested in
dstr
nodes. (@bbatsov)
RuboCop 0.20.1
RuboCop 0.20.1 is a bugfix-only release. Below is a list of the bugs we've fixed since 0.20.0:
0.20.1 (05/04/2014)
Bugs fixed
- #940: Fixed
UselessAccessModifier
not handlingattr_*
correctly. (@fshowalter) NegatedIf
properly handles negatedunless
condition. (@bbatsov)NegatedWhile
properly handles negateduntil
condition. (@bbatsov)- #925: Do not disable the
Syntax
cop in output from--auto-gen-config
. (@jonas054) - #943: Fix auto-correction interference problem between
SpaceAfterComma
and other cops. (@jonas054) - #954: Fix auto-correction bug in
NilComparison
. (@bbatsov) - #953: Fix auto-correction bug in
NonNilCheck
. (@bbatsov) - #952: Handle implicit receiver in
StringConversionInInterpolation
. (@bbatsov) - #956: Apply
ClassMethods
check only onclass
/module
bodies. (@bbatsov) - #945: Fix SpaceBeforeFirstArg cop for multiline argument and exclude assignments. (@cschramm)
- #948:
Blocks
cop avoids auto-correction if it would introduce a semantic change. (@jonas054) - #946: Allow non-nil checks that are the final expressions of predicate method definitions in
NonNilCheck
. (@bbatsov) - #957: Allow space + comment inside parentheses, braces, and square brackets. (@jonas054)
RuboCop 0.20.0
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)