- #1430: Add
--except
option for disabling cops on the command line. (@jonas054) - #1506: Add auto-correct from
EvenOdd
cop. (@blainesch) - #1507:
Debugger
cop now checks for the Capybara debug methodssave_and_open_page
andsave_and_open_screenshot
. (@rrosenblum) - #1539: Implement autocorrection for Rails/ReadWriteAttribute cop. (@huerlisi)
- #1324: Add
AllCops/DisplayCopNames
configuration option for showing cop names in reports, like--display-cop-names
. (@jonas054) - #1271:
Lambda
cop does auto-correction. (@lumeet) - #1284: Support namespaces, e.g.
Lint
, in the arguments to--only
and--except
. (@jonas054) - #1276:
SelfAssignment
cop does auto-correction. (@lumeet) - Add autocorrect to
RedundantException
. (@mattjmcnaughton) - #1571: New cop
StructInheritance
checks for inheritance from Struct.new. (@mmozuras) - #1575: New cop
DuplicateMethods
points out duplicate method name in class and module. (@d4rk5eed) - #1583: Add
quiet
formatter that is silent when no offenses are found. (@dhempy)
- #1492: Abort when auto-correct causes an infinite loop. (@dblock)
- Options
-e
/--emacs
and-s
/--silent
are no longer recognized. Using them will now raise an error. (@bquorning) - #1565: Let
--fail-level A
cause exit with error if all offenses are auto-corrected. (@jonas054) - #1309: Add argument handling to
MultilineBlockLayout
. (@lumeet)
- #1553: Fix bug where
Style/EmptyLinesAroundAccessModifier
interfered withStyle/EmptyLinesAroundBlockBody
when there is and access modifier at the beginning of a block. (@volkert) - Handle element assignment in
Lint/AssignmentInCondition
. (@jonas054) - #1484: Fix
EmptyLinesAroundAccessModifier
incorrectly finding a violation inside method calls with names identical to an access modifier. (@dblock) - Fix bug concerning
Exclude
properties inherited from a higher directory level. (@jonas054) - #1500: Fix crashing
--auto-correct --only IndentationWidth
. (@jonas054) - #1512: Fix false negative for typical string formatting examples. (@kakutani, @jonas054)
- #1504: Fail with a meaningful error if the configuration file is malformed. (@bquorning)
- Fix bug where
auto_correct
Rake tasks does not take in the options specified in its parent task. (@rrosenblum) - #1054: Handle comments within concatenated strings in
LineEndConcatenation
. (@yujinakayama, @jonas054) - #1527: Make autocorrect
BracesAroundHashParameter
leave the correct number of spaces. (@mattjmcnaughton) - #1547: Don't print
[Corrected]
when auto-correction was avoided inStyle/Semicolon
. (@jonas054) - #1573: Fix assignment-related auto-correction for
BlockAlignment
. (@lumeet) - #1587: Exit with exit code 1 if there were errors ("crashing" cops). (@jonas054)
- #1574: Avoid auto-correcting
Hash.new
to{}
when braces would be interpreted as a block. (@jonas054) - #1591: Don't check parameters inside
[]
inMultilineOperationIndentation
. (@jonas054) - #1509: Ignore class methods in
Rails/Delegate
. (@bbatsov) - #1594: Fix
@example
warnings in Yard Doc documentation generation. (@mattjmcnaughton)
- New cop
ExtraSpacing
points out unnecessary spacing in files. (@blainesch) - New cop
EmptyLinesAroundBlockBody
provides same functionality as the EmptyLinesAround(Class|Method|Module)Body but for blocks. (@jcarbo) - New cop
Style/EmptyElse
checks for emptyelse
-clauses. (@Koronen) - #1454: New
--only-guide-cops
andAllCops/StyleGuideCopsOnly
options that will only enforce cops that link to a style guide. (@marxarelli)
- #801: New style
context_dependent
forStyle/BracesAroundHashParameters
looks at preceding parameter to determine if braces should be used for final parameter. (@jonas054) - #1427: Excluding directories on the top level is now done earlier, so that these file trees are not searched, thus saving time when inspecting projects with many excluded files. (@jonas054)
- #1325: When running with
--auto-correct
, only offenses that can not be corrected will result in a non-zero exit code. (@jonas054) - #1445: Allow sprockets directive comments (starting with
#=
) inStyle/LeadingCommentSpace
. (@bbatsov)
- Fix
%W[]
auto corrected to%w(]
. (@toy) - Fix Style/ElseAlignment Cop to find the right parent on def/rescue/else/ensure/end. (@oneamtu)
- #1181: (fix again)
Style/StringLiterals
cop stays away from strings inside interpolated expressions. (@jonas054) - #1441: Correct the logic used by
Style/Blocks
and other cops to determine if an auto-correction would alter the meaning of the code. (@jonas054) - #1449: Handle the case in
MultilineOperationIndentation
where instances of both correct style and unrecognized (plain wrong) style are detected during an--auto-gen-config
run. (@jonas054) - #1456: Fix autocorrect in
SymbolProc
when there are multiple offenses on the same line. (@jcarbo) - #1459: Handle parenthesis around the condition in
--auto-correct
forNegatedWhile
. (@jonas054) - #1465: Fix autocorrect of code like
#$1
inPerlBackrefs
. (@bbatsov) - Fix autocorrect of code like
#$:
inSpecialGlobalVars
. (@bbatsov) - #1466: Allow leading underscore for unused parameters in
SingleLineBlockParams
. (@jonas054) - #1470: Handle
elsif
+else
inElseAlignment
. (@jonas054) - #1474: Multiline string with both
<<
and\
caught byStyle/LineEndConcatenation
cop. (@katieschilling) - #1485: Ignore procs in
SymbolProc
. (@bbatsov) - #1473:
Style/MultilineOperationIndentation
doesn't recognize assignment to array/hash element. (@jonas054)
- #1343: Remove auto-correct from
RescueException
cop. (@bbatsov) - #1425:
AllCops/Include
configuration parameters are only taken from the project.rubocop.yml
and files it inherits from, not from.rubocop.yml
files in subdirectories. (@jonas054)
- #1411: Handle lambda calls without a selector in
MultilineOperationIndentation
. (@bbatsov) - #1401: Files in hidden directories, i.e. ones beginning with dot, can now be selected through configuration, but are still not included by default. (@jonas054)
- #1415: String literals concatenated with backslashes are now handled correctly by
StringLiteralsInInterpolation
. (@jonas054) - #1416: Fix handling of
begin/rescue/else/end
inElseAlignment
. (@jonas054) - #1413: Support empty elsif branches in
MultilineIfThen
. (@janraasch, @jonas054) - #1406: Allow a newline in
SpaceInsideRangeLiteral
. (@bbatsov)
- #1348: New cop
ElseAlignment
checks alignment ofelse
andelsif
keywords. (@jonas054) - #1321: New cop
MultilineOperationIndentation
checks indentation/alignment of binary operations if they span more than one line. (@jonas054) - #1077: New cop
Metrics/AbcSize
checks the ABC metric, based on assignments, branches, and conditions. (@jonas054, @jfelchner) - #1352:
WordArray
is now configurable with theWordRegex
option. (@bquorning) - #1181: New cop
Style/StringLiteralsInInterpolation
checks quotes inside interpolated expressions in strings. (@jonas054) - #872:
Style/IndentationWidth
is now configurable with theWidth
option. (@jonas054) - #1396: Include
.opal
files by default. (@bbatsov) - #771: Three new
Style
cops,EmptyLinesAroundMethodBody
,EmptyLinesAroundClassBody
, andEmptyLinesAroundModuleBody
replace theEmptyLinesAroundBody
cop. (@jonas054)
AlignHash
no longer skips multiline hashes that contain some elements on the same line. (@mvz)- #1349:
BracesAroundHashParameters
no longer cleans up whitespace in autocorrect, as these extra corrections are likely to interfere with other cops' corrections. (@jonas054) - #1350: Guard against
Blocks
cop introducing syntax errors in auto-correct. (@jonas054) - #1374: To eliminate interference, auto-correction is now done by one cop at a time, with saving and re-parsing inbetween. (@jonas054)
- #1388: Fix a false positive in
FormatString
. (@bbatsov) - #1389: Make
--out
to create parent directories. (@yous) - Refine HTML formatter. (@yujinakayama)
- #1410: Handle specially Java primitive type references in
ColonMethodCall
. (@bbatsov)
- #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)
- 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)
- #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)
- #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)
- #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 expression 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)
- #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)
- #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)
- #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)
- #639: Support square bracket setters in
UselessSetterCall
. (@yujinakayama) - #835:
UnneededCapitalW
cop does auto-correction. (@sfeldon) - #1092: New cop
DefEndAlignment
takes over responsibility for checking 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)
- 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)
- #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)
- #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)
- #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)
- #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)
- #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 iteration 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) - Add optional
require
directive to.rubocop.yml
to load custom ruby files. (@geniou)
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 ignoring 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)
- 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)
- #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)
- Removed
FinalNewline
cop as its check is now performed byTrailingBlankLines
. (@jonas054) - #1011: Pattern matching with
Dir#[]
for config parameters added. (@jonas054)
- 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)
- #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)
- 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)
- #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)
- #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)
- #884: Fix --auto-gen-config for
NumericLiterals
so MinDigits is correct. (@tmorris-fiksu) - #879: Fix --auto-gen-config for
RegexpLiteral
so we don't generate illegal values forMaxSlashes
. (@jonas054) - Fix the name of the
Include
param in the default config of the Rails cops. (@bbatsov) - #878: Blacklist
Rakefile
,Gemfile
andCapfile
by default in theFileName
cop. (@bbatsov) - #875: Handle
separator
style hashes inIndentHash
. (@jonas054) - Fix a bug where multiple cli options that result in exit can be specified at once (e.g.
-vV
,-v --show-cops
). (@jkogara) - #889: Fix a false positive for
LiteralInCondition
when the condition is non-primitive array. (@bbatsov)
- 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 redundantObject#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 thescope
method properly. (@bbatsov) - Add
with_fixed_indentation
style toAlignParameters
cop. (@hannestyden) - Add
IgnoreLastArgumentHash
option toAlignHash
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
andWhileUntilModifier
supportsMaxLineLength
, which is independent ofLineLength
parameterMax
. (@agrimm) - #868: New cop
ClassAndModuleChildren
checks the style of children definitions at classes and modules: nested / compact. (@geniou)
- #793: Add printing total count when
rubocop --format offences
. (@ma2gedev) - Remove
Ignore
param from the RailsOutput
cop. The standardExclude/Include
should be used instead. (@bbatsov) - Renamed
FavorSprintf
toFormatString
and made it configurable. (@bbatsov) - Renamed
Offence
toOffense
. (@bbatsov) - Use
offense
in all messages instead ofoffence
. (@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 byEndAlignment
/AlignWith
. (@jonas054) - Renamed
Style
param ofDotPosition
cop toEnforcedStyle
. (@bbatsov) - Add
length
value to locations of offense in JSON formatter. (@yujinakayama) SpaceAroundBlockBraces
cop replaced bySpaceBeforeBlockBraces
andSpaceInsideBlockBraces
. (@jonas054)SpaceAroundEqualsInParameterDefault
cop is now configurable with theEnforcedStyle
option. (@jonas054)
- #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
withretry
) inUselessAssignment
. (@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 whenAlignWith
iskeyword
. (@jonas054) - Handle
case
conditions inLiteralInCondition
. (@bbatsov) - #822: Fix a false positive in
DotPosition
when enforced style is set totrailing
. (@bbatsov) - Handle properly dynamic strings in
LineEndConcatenation
. (@bbatsov) - #832: Fix auto-correction interference problem between
BracesAroundHashParameters
andSpaceInsideHashLiteralBraces
. (@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 thatIndentationConsistency
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 includingall
(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) - #877: Fix bug in
PercentLiteralDelimiters
concerning auto-correct of regular expressions with interpolation. (@hannestyden)
- Remove double reporting in
EmptyLinesAroundBody
of empty line inside otherwise empty class/module/method that caused crash in autocorrect. (@jonas054) - #779: Fix a false positive in
LineEndConcatenation
. (@bbatsov) - #751: Fix
Documentation
cop so that a comment followed by an empty line and then a class definition is not considered to be class documentation. (@jonas054) - #783: Fix a false positive in
ParenthesesAroundCondition
when the parentheses are actually required. (@bbatsov) - #781: Fix problem with back-and-forth auto-correction in
AccessModifierIndentation
. (@jonas054) - #785: Fix false positive on
%w
arrays inTrailingComma
. (@jonas054) - #782: Fix false positive in
AlignHash
for single line hashes. (@jonas054)
- #714: New cop
RequireParentheses
checks for method calls without parentheses together with a boolean operator indicating that a mistake about precedence may have been made. (@jonas054) - #743:
WordArray
cop does auto-correction. (@jonas054) - #743:
Proc
cop does auto-correction. (@bbatsov) - #743:
AccessModifierIndentation
cop does auto-correction. (@jonas054) - #768: Rake task now supports
requires
andoptions
. (@nevir) - #759: New cop
EndLineConcatenation
checks for string literal concatenation with+
at line end. (@bbatsov)
- #762: Support Rainbow gem both 1.99.x and 2.x. (@yujinakayama)
- #761: Relax
json
requirement to>= 1.7.7
. (@bbatsov) - #757:
Include/Exclude
supports relative globbing to some extent. (@nevir)
- #764: Handle heredocs in
TrailingComma
. (@jonas054) - Guide for contributors now points to correct issues page. (@scottmatthewman)
- New cop
ConditionPosition
checks for misplaced conditions in expressions likeif/unless/when/until
. (@bbatsov) - New cop
ElseLayout
checks for odd arrangement of code in theelse
branch of a conditional expression. (@bbatsov) - #694: Support Ruby 1.9.2 until June 2014. (@yujinakayama)
- #702: Improve
rubocop-todo.yml
with comments about offence count, configuration parameters, and auto-correction support. (@jonas054) - Add new command-line flag
-D/--display-cop-names
to trigger the display of cop names in offence messages. (@bbatsov) - #733:
NumericLiterals
cop does auto-correction. (@dblock) - #713: New cop
TrailingComma
checks for comma after the last item in a hash, array, or method call parameter list. (@jonas054)
- #581: Extracted a new cop
AmbiguousOperator
fromSyntax
cop. It checks for ambiguous operators in the first argument of a method invocation without parentheses. (@yujinakayama) - Extracted a new cop
AmbiguousRegexpLiteral
fromSyntax
cop. It checks for ambiguous regexp literals in the first argument of a method invocation without parentheses. (@yujinakayama) - Extracted a new cop
UselessElseWithoutRescue
fromSyntax
cop. It checks for uselesselse
inbegin..end
withoutrescue
. (@yujinakayama) - Extracted a new cop
InvalidCharacterLiteral
fromSyntax
cop. It checks for invalid character literals with a non-escaped whitespace character (e.g.?
). (@yujinakayama) - Removed
Syntax
cop from the configuration. It no longer can be disabled and it reports only invalid syntax offences. (@yujinakayama) - #688: Output from
rubocop --show-cops
now looks like a YAML configuration file. The--show-cops
option takes a comma separated list of cops as optional argument. (@jonas054) - New cop
IndentationConsistency
extracted fromIndentationWidth
, which has checked two kinds of offences until now. (@jonas054)
- #698: Support Windows paths on command-line. (@rifraf)
- #498: Disable terminal ANSI escape sequences when a formatter's output is not a TTY. (@yujinakayama)
- #703: BracesAroundHashParameters auto-correction broken with trailing comma. (@jonas054)
- #709: When
EndAlignment
has configurationAlignWith: variable
, it now handles@@a = if ...
anda, b = if ...
. (@jonas054) SpaceAroundOperators
now reports an offence for@@a=0
. (@jonas054)- #707: Fix error on operator assignments in top level scope in
UselessAssignment
. (@yujinakayama) - Fix a bug where some offences were discarded when any cop that has specific target file path (by
Include
orExclude
under each cop configuration) had run. (@yujinakayama) - #724: Accept colons denoting required keyword argument (a new feature in Ruby 2.1) without trailing space in
SpaceAfterColon
. (@jonas054) - The
--no-color
option works again. (@jonas054) - #716: Fixed a regression in the auto-correction logic of
MethodDefParentheses
. (@bbatsov) - Inspected projects that lack a
.rubocop.yml
file, and therefore get their configuration from RuboCop'sconfig/default.yml
, no longer get configuration from RuboCop's.rubocop.yml
andrubocop-todo.yml
. (@jonas054) - #730:
EndAlignment
now handles for exampleprivate def some_method
, which is allowed in Ruby 2.1. It requiresend
to be aligned withprivate
, notdef
, in such cases. (@jonas054) - #744: Any new offences created by
--auto-correct
are now handled immediately and corrected when possible, so running--auto-correct
once is enough. (@jonas054) - #748: Auto-correction conflict between
EmptyLinesAroundBody
andTrailingWhitespace
resolved. (@jonas054) ParenthesesAroundCondition
no longer crashes on parentheses around the condition in a ternary if. (@jonas054)- #738: Fix a false positive in
StringLiterals
. (@bbatsov)
- #612:
BracesAroundHashParameters
cop does auto-correction. (@dblock) - #614:
ParenthesesAroundCondition
cop does auto-correction. (@dblock) - #624:
EmptyLines
cop does auto-correction. (@dblock) - New Rails cop
DefaultScope
ensuresdefault_scope
is called properly with a block argument. (@bbatsov) - All cops now support the
Include
param, which specifies the files on which they should operate. (@bbatsov) - All cops now support the
Exclude
param, which specifies the files on which they should not operate. (@bbatsov) - #631:
IndentationWidth
cop now detects inconsistent indentation between lines that should have the same indentation. (@jonas054) - #649:
EmptyLinesAroundBody
cop does auto-correction. (@dblock) - #657:
Alias
cop does auto-correction. (@dblock) - Rake task now support setting formatters. (@pmenglund)
- #653:
CaseIndentation
cop is now configurable with parametersIndentWhenRelativeTo
andIndentOneStep
. (@jonas054) - #654:
For
cop is now configurable to enforce eithereach
(default) orfor
. (@jonas054) - #661:
EndAlignment
cop is now configurable for alignment withkeyword
(default) orvariable
. (@jonas054) - Allow to overwrite the severity of a cop with the new
Severity
param. (@codez) - New cop
FlipFlop
checks for flip flops. (@agrimm) - #577: Introduced
MethodDefParentheses
to allow for for requiring either parentheses or no parentheses in method definitions. ReplacesDefWithoutParentheses
. (@skanev) - #693: Generation of parameter values (i.e., not only
Enabled: false
) inrubocop-todo.yml
by the--auto-gen-config
option is now supported for some cops. (@jonas054) - New cop
AccessorMethodName
checks accessor method names for non-idiomatic names likeget_attribute
andset_attribute
. (@bbatsov) - New cop
PredicateName
checks the names of predicate methods for non-idiomatic names likeis_something
,has_something
, etc. (@bbatsov) - Support Ruby 2.1 with Parser 2.1. (@yujinakayama)
- Removed
SymbolNames
as it was generating way too many false positives. (@bbatsov) - Renamed
ReduceArguments
toSingleLineBlockParams
and made it configurable. (@bbatsov)
- Handle properly heredocs in
StringLiterals
cop. (@bbatsov) - Fix
SpaceAroundOperators
to not report missing space around operator fordef self.method *args
. (@jonas054) - Properly handle
['AllCops']['Includes']
and['AllCops']['Excludes']
when passing config via-c
. (@fancyremarker, @codez) - #611: Fix crash when loading an empty config file. (@sinisterchipmunk)
- Fix
DotPosition
cop withtrailing
style for method calls on same line. (@vonTronje) - #627: Fix counting of slashes in complicated regexps in
RegexpLiteral
cop. (@jonas054) - #638: Fix bug in auto-correct that changes
each{ |x|
toeach d o |x|
. (@jonas054) - #418: Stop searching for configuration files above the work directory of the isolated environment when running specs. (@jonas054)
- Fix error on implicit match conditionals (e.g.
if /pattern/; end
) inMultilineIfThen
. (@agrimm) - #651: Handle properly method arguments in
RedundantSelf
. (@bbatsov) - #628: Allow
self.Foo
inRedundantSelf
cop. (@chulkilee) - #668: Fix crash in
EndOfLine
that occurs when default encoding isUS_ASCII
and an inspected file has non-ascii characters. (@jonas054) - #664: Accept oneline while when condition has local variable assignment. (@emou)
- Fix auto-correct for
MethodDefParentheses
when parentheses are required. (@skanev)
- New cop
Output
checks for calls to print, puts, etc. in Rails. (@daviddavis) - New cop
EmptyLinesAroundBody
checks for empty lines around the bodies of class, method and module definitions. (@bbatsov) LeadingCommentSpace
cop does auto-correction. (@jonas054)SpaceAfterControlKeyword
cop does auto-correction. (@jonas054)SpaceAfterColon
cop does auto-correction. (@jonas054)SpaceAfterComma
cop does auto-correction. (@jonas054)SpaceAfterSemicolon
cop does auto-correction. (@jonas054)SpaceAfterMethodName
cop does auto-correction. (@jonas054)SpaceAroundBlockBraces
cop does auto-correction. (@jonas054)SpaceAroundEqualsInParameterDefault
cop does auto-correction. (@jonas054)SpaceAroundOperators
cop does auto-correction. (@jonas054)SpaceBeforeModifierKeyword
cop does auto-correction. (@jonas054)SpaceInsideHashLiteralBraces
cop does auto-correction. (@jonas054)SpaceInsideBrackets
cop does auto-correction. (@jonas054)SpaceInsideParens
cop does auto-correction. (@jonas054)TrailingWhitespace
cop does auto-correction. (@jonas054)TrailingBlankLines
cop does auto-correction. (@jonas054)FinalNewline
cop does auto-correction. (@jonas054)- New cop
CyclomaticComplexity
checks the cyclomatic complexity of methods against a configurable max value. (@jonas054) - #594: New parameter
EnforcedStyleForEmptyBraces
with valuesspace
andno_space
(default) added toSpaceAroundBlockBraces
. (@jonas054) - #603: New parameter
MinSize
added toWordArray
to allow small string arrays, retaining the default (0). (@claco)
- #557: Configuration files for excluded files are no longer loaded. (@jonas054)
- #571: The default rake task now runs RuboCop over itself! (@nevir)
- Encoding errors are reported as fatal offences rather than printed with red text. (@jonas054)
AccessControl
cop is now configurable with theEnforcedStyle
option. (@sds)- Split
AccessControl
cop toAccessModifierIndentation
andEmptyLinesAroundAccessModifier
. (@bbatsov) - #594: Add configuration parameter
EnforcedStyleForEmptyBraces
toSpaceInsideHashLiteralBraces
cop, and changeEnforcedStyleIsWithSpaces
(valuestrue
,false
) toEnforcedStyle
(valuesspace
,no_space
). (@jonas054) - Coverage builds linked from the README page are enabled again. (@jonas054)
- #561: Handle properly negative literals in
NumericLiterals
cop. (@bbatsov) - #567: Register an offence when the last hash parameter has braces in
BracesAroundHashParameters
cop. (@dblock) StringLiterals
cop no longer reports errors for character literals such as ?/. That should be done only by theCharacterLiterals
cop. (@jonas054)- Made auto-correct much less likely to crash due to conflicting corrections ("clobbering"). (@jonas054)
- #565:
$GLOBAL_VAR from English library
should no longer be inserted when autocorrecting short-form global variables like$!
. (@nevir) - #566: Methods that just assign a splat to an ivar are no longer considered trivial writers. (@nevir)
- #585:
MethodCallParentheses
should allow methods starting with uppercase letter. (@bbatsov) - #574: Fix error on multiple-assignment with non-array right hand side in
UselessSetterCall
. (@yujinakayama) - #576: Output config validation warning to STDERR so that it won't be mixed up with formatter's output. (@yujinakayama)
- #599:
EndOfLine
cop is operational again. (@jonas054) - #604: Fix error on implicit match conditionals (e.g.
if /pattern/; end
) inFavorModifier
. (@yujinakayama) - #600: Don't require an empty line for access modifiers at the beginning of class/module body. (@bbatsov)
- #608:
RescueException
no longer crashes when the namespace of a rescued class is in a local variable. (@jonas054) - #173: Allow the use of
alias
in the body of aninstance_exec
. (@bbatsov) - #554: Handle properly multi-line arrays with comments in them in
WordArray
. (@bbatsov)
- #551: New cop
BracesAroundHashParameters
checks for braces in function calls with hash parameters. (@dblock) - New cop
SpaceAfterNot
tracks redundant space after the!
operator. (@bbatsov)
- Fix bug concerning table and separator alignment of multi-line hash with multiple keys on the same line. (@jonas054)
- #550: Fix a bug where
ClassLength
counted lines of inner classes/modules. (@yujinakayama) - #550: Fix a false positive for namespace class in
Documentation
. (@yujinakayama) - #556: Fix "Parser::Source::Range spans more than one line" bug in clang formatter. (@yujinakayama)
- #552:
RaiseArgs
allows exception constructor calls with more than one 1 argument. (@bbatsov)
- #491: New cop
MethodCalledOnDoEndBlock
keeps track of methods called ondo
...end
blocks. - #456: New configuration parameter
AllCops
/RunRailsCops
can be set totrue
for a project, removing the need to give the-R
/--rails
option with every invocation ofrubocop
. - #501:
simple
/clang
/progress
/emacs
formatters now print[Corrected]
along with offence message when the offence is automatically corrected. - #501:
simple
/clang
/progress
formatters now print count of auto-corrected offences in the final summary. - #501:
json
formatter now outputscorrected
key with boolean value in offence objects whether the offence is automatically corrected. - New cop
ClassLength
checks for overly long class definitions. - New cop
Debugger
checks for forgotten calls to debugger or pry. - New cop
RedundantException
checks for code likeraise RuntimeError, message
. - #526: New cop
RaiseArgs
checks the args passed toraise/fail
.
- Cop
MethodAndVariableSnakeCase
replaced byMethodName
andVariableName
, both having the configuration parameterEnforcedStyle
with valuessnake_case
(default) andcamelCase
. - #519:
HashSyntax
cop is now configurable and can enforce the use of the classic hash rockets syntax. - #520:
StringLiterals
cop is now configurable and can enforce either single-quoted or double-quoted strings. - #528: Added a config option to
RedundantReturn
to allow areturn
with multiple values. - #524: Added a config option to
Semicolon
to allow the use of;
as an expression separator. - #525:
SignalException
cop is now configurable and can enforce the semantic rule or an exclusive use ofraise
orfail
. LambdaCall
is now configurable and enforce eitherProc#call
orProc#()
.- #529: Added config option
EnforcedStyle
toSpaceAroundBraces
. - #529: Changed config option
NoSpaceBeforeBlockParameters
toSpaceBeforeBlockParameters
. - Support Parser 2.0.0 (non-beta).
- #514: Fix alignment of the hash containing different key lengths in one line.
- #496: Fix corner case crash in
AlignHash
cop: single key/value pair when configuration istable
for '=>' andseparator
for:
. - #502: Don't check non-decimal literals with
NumericLiterals
. - #448: Fix auto-correction of parameters spanning more than one line in
AlignParameters
cop. - #493: Support disabling
Syntax
offences withwarning
severity. - Fix bug appearing when there were different values for the
AllCops
/RunRailsCops
configuration parameter in different directories. - #512: Fix bug causing crash in
AndOr
auto-correction. - #515: Fix bug causing
AlignParameters
andAlignArray
auto-correction to destroy code. - #516: Fix bug causing
RedundantReturn
auto-correction to produce invalid code. - #527: Handle
!=
expressions inEvenOdd
cop. SignalException
cop now findsraise
calls anywhere, not only inbegin
sections.- #538: Fix bug causing
Blocks
auto-correction to produce invalid code.
HashSyntax
cop does auto-correction.- #484: Allow calls to self to fix name clash with argument.
- Renamed
SpaceAroundBraces
toSpaceAroundBlockBraces
. SpaceAroundBlockBraces
now has aNoSpaceBeforeBlockParameters
config option to enforce a style for blocks with parameters like{|foo| puts }
.- New cop
LambdaCall
tracks uses of the obscurelambda.(...)
syntax.
- Fix crash on empty input file in
FinalNewline
. - #485: Fix crash on multiple-assignment and op-assignment in
UselessSetterCall
. - #497: Fix crash in
UselessComparison
andNilComparison
.
- New configuration parameter
AllowAdjacentOneLineDefs
forEmptyLineBetweenDefs
. - New cop
MultilineBlockChain
keeps track of chained blocks spanning multiple lines. RedundantSelf
cop does auto-correction.AvoidPerlBackrefs
cop does auto-correction.AvoidPerlisms
cop does auto-correction.RedundantReturn
cop does auto-correction.Blocks
cop does auto-correction.- New cop
TrailingBlankLines
keeps track of extra blanks lines at the end of source file. - New cop
AlignHash
keeps track of bad alignment in multi-line hash literals. - New cop
AlignArray
keeps track of bad alignment in multi-line array literals. - New cop
SpaceBeforeModifierKeyword
keeps track of missing space before a modifier keyword (if
,unless
,while
,until
). - New cop
FinalNewline
keeps tracks of the required final newline in a source file. - Highlightling corrected in
SpaceInsideHashLiteralBraces
andSpaceAroundBraces
cops.
- #447:
BlockAlignment
cop now allowsend
to be aligned with the start of the line containingdo
. SymbolName
now has anAllowDots
config option to allow symbols like:'whatever.submit_button'
.- #469: Extracted useless setter call tracking part of
UselessAssignment
cop toUselessSetterCall
. - #469: Merged
UnusedLocalVariable
cop intoUselessAssignment
. - #458: The merged
UselessAssignment
cop now has advanced logic that tracks not only assignment at the end of the method but also every assignment in every scope. - #466: Allow built-in JRuby global vars in
AvoidGlobalVars
. - Added a config option
AllowedVariables
toAvoidGlobalVars
to allow users to whitelist certain global variables. - Renamed
AvoidGlobalVars
toGlobalVars
. - Renamed
AvoidPerlisms
toSpecialGlobalVars
. - Renamed
AvoidFor
toFor
. - Renamed
AvoidClassVars
toClassVars
. - Renamed
AvoidPerlBackrefs
toPerlBackrefs
. NumericLiterals
now accepts a config paramMinDigits
- the minimal number of digits in the integer portion of number for the cop to check it.
- #449: Remove whitespaces between condition and
do
withWhileUntilDo
auto-correction. - Continue with file inspection after parser warnings. Give up only on syntax errors.
- Don't trigger the HashSyntax cop on digit-starting keys.
- Fix crashes while inspecting class definition subclassing another class stored in a local variable in
UselessAssignment
(formerly ofUnusedLocalVariable
) andShadowingOuterLocalVariable
(likeclazz = Array; class SomeClass < clazz; end
). - #463: Do not warn if using destructuring in second
reduce
argument (ReduceArguments
).
- #439: Added formatter 'OffenceCount' which outputs a summary list of cops and their offence count.
- #395: Added
--show-cops
option to show available cops. - New cop
NilComparison
keeps track of comparisons like== nil
. - New cop
EvenOdd
keeps track of occasions whereFixnum#even?
orFixnum#odd?
should have been used (likex % 2 == 0
). - New cop
IndentationWidth
checks for files using indentation that is not two spaces. - New cop
SpaceAfterMethodName
keeps track of method definitions with a space between the method name and the opening parenthesis. - New cop
ParenthesesAsGroupedExpression
keeps track of method calls with a space before the opening parenthesis. - New cop
HashMethods
keeps track of uses of deprecatedHash
methods. - New Rails cop
HasAndBelongsToMany
checks for uses ofhas_and_belongs_to_many
. - New Rails cop
ReadAttribute
tracks uses ofread_attribute
. Attr
cop does auto-correction.CollectionMethods
cop does auto-correction.SignalException
cop does auto-correction.EmptyLiteral
cop does auto-correction.MethodCallParentheses
cop does auto-correction.DefWithParentheses
cop does auto-correction.DefWithoutParentheses
cop does auto-correction.
- Dropped
-s
/--silent
option. Nowprogress
/simple
/clang
formatters always report summary andemacs
/files
formatters no longer report. - Dropped the
LineContinuation
cop.
- #432: Fix false positive for constant assignments when rhs is a method call with block in
ConstantName
. - #434: Support classes and modules defined with
Class.new
/Module.new
inAccessControl
. - Fix which ranges are highlighted in reports from IfUnlessModifier, WhileUntilModifier, and MethodAndVariableSnakeCase cop.
- #438: Accept setting attribute on method argument in
UselessAssignment
.
- #425:
ColonMethodCalls
now allows constructor methods (likeNokogiri::HTML()
to be called with double colon.
- #427: FavorUnlessOverNegatedIf triggered when using elsifs.
- #429: Fix
LeadingCommentSpace
offence reporting. - Fixed
AsciiComments
offence reporting. - Fixed
BlockComments
offence reporting.
- #421:
TrivialAccessors
now ignores methods on user-configurable whitelist (such asto_s
andto_hash
). - #369: New option
--auto-gen-config
outputs RuboCop configuration that disables all cops that detect any offences. - The list of annotation keywords recognized by the
CommentAnnotation
cop is now configurable. - Configuration file names are printed as they are loaded in
--debug
mode. - Auto-correct support added in
AlignParameters
cop. - New cop
UselessComparison
checks for comparisons of the same arguments. - New cop
UselessAssignment
checks for useless assignments to local variables. - New cop
SignalException
checks for proper usage offail
andraise
. - New cop
ModuleFunction
checks for usage ofextend self
in modules.
- #374: Fixed error at post condition loop (
begin-end-while
,begin-end-until
) inUnusedLocalVariable
andShadowingOuterLocalVariable
. - #373 and #376: Allow braces around multi-line blocks if
do
-end
would change the meaning of the code. RedundantSelf
now allowsself.
followed by any ruby keyword.- #391: Fix bug in counting slashes in a regexp.
- #394:
DotPosition
cop handles correctly code likel.(1)
. - #390:
CommentAnnotation
cop allows keywords (e.g. Review, Optimize) if they just begin a sentence. - #400: Fix bug concerning nested defs in
EmptyLineBetweenDefs
cop. - #399: Allow assignment inside blocks in
AssignmentInCondition
cop. - Fix bug in favor_modifier.rb regarding missed offences after else etc.
- #393: Retract support for multiline chaining of blocks (which fixed #346), thus rejecting issue 346.
- #389: Ignore symbols that are arguments to Module#private_constant in
SymbolName
cop. - #387: Do autocorrect in
AndOr
cop only if it does not change the meaning of the code. - #398: Don't display blank lines in the output of the clang formatter.
- #283: Refine
StringLiterals
string content check.
- New cop
RedundantReturn
tracks redundantreturn
s in method bodies. - New cop
RedundantBegin
tracks redundantbegin
blocks in method definitions. - New cop
RedundantSelf
tracks redundant uses ofself
. - New cop
EmptyEnsure
tracks emptyensure
blocks. - New cop
CommentAnnotation
tracks formatting of annotation comments such as TODO. - Added custom rake task.
- New formatter
FileListFormatter
outputs just a list of files with offences in them (related to #357).
TrivialAccessors
now has anExactNameMatch
config option (related to #308).TrivialAccessors
now has anExcludePredicates
config option (related to #326).- Cops don't inherit from
Parser::AST::Rewriter
anymore. All 3rd party Cops should remove the call tosuper
in their callbacks. If you implement your own processing you need to define the#investigate
method instead of#inspect
. Refer to the documentation ofCop::Commissioner
andCop::Cop
classes for more information. EndAlignment
cop split intoEndAlignment
andBlockAlignment
cops.
- #288: Work with absolute Excludes paths internally (2nd fix for this issue).
TrivialAccessors
now detects class attributes as well as instance attributes.- #338: Fix end alignment of blocks in chained assignments.
- #345: Add
$SAFE
to the list of built-in global variables. - #340: Override config parameters rather than merging them.
- #349: Fix false positive for
CharacterLiteral
(%w(?)
). - #346: Support method chains for block end alignment checks.
- #350: Support line breaks between variables on left hand side for block end alignment checks.
- #356: Allow safe assignment in
ParenthesesAroundCondition
.
- Improved performance on Ruby 1.9 by about 20%.
- Improved overall performance by about 35%.
- Added
-l/--lint
option to allow doing only linting with no style checks (similar to runningruby -wc
).
- Removed the
BlockAlignSchema
configuration option fromEndAlignment
. We now support only the default alignment schema -StartOfAssignment
. - Made the preferred collection methods in
CollectionMethods
configurable. - Made the
DotPosition
cop configurable - now bothleading
andtrailing
styles are supported.
- #318: Correct some special cases of block end alignment.
- #317: Fix a false positive in
LiteralInCondition
. - #321: Ignore variables whose name start with
_
inShadowingOuterLocalVariable
. - #322: Fix exception of
UnusedLocalVariable
andShadowingOuterLocalVariable
when inspecting keyword splat argument. - #316: Correct nested postfix unless in
MultilineIfThen
. - #327: Fix false offences for block expression that span on two lines in
EndAlignment
. - #332: Fix exception of
UnusedLocalVariable
andShadowingOuterLocalVariable
when inspecting named captures. - #333: Fix a case that
EnsureReturn
throws an exception when ensure has no body.
- Introduced formatter feature, enables custom formatted output and multiple outputs.
- Added progress formatter and now it's the default. (
--format progress
). - Added JSON formatter. (
--format json
). - Added clang style formatter showing the offending source. code. (
--format clang
). Theclang
formatter marks a whole range rather than just the starting position, to indicate more clearly where the problem is. - Added
-f
/--format
option to specify formatter. - Added
-o
/--out
option to specify output file for each formatter. - Added
-r/--require
option to inject external Ruby code into RuboCop. - Added
-V/--verbose-version
option that displays Parser version and Ruby version as well. - Added
-R/--rails
option that enables extra Rails-specific cops. - Added support for auto-correction of some offences with
-a
/--auto-correct
. - New cop
CaseEquality
checks for explicit use of===
. - New cop
AssignmentInCondition
checks for assignment in conditions. - New cop
EndAlignment
tracks misalignedend
keywords. - New cop
Void
tracks uses of literals/variables/operators in possibly void context. - New cop
Documentation
checks for top level class/module doc comments. - New cop
UnreachableCode
tracks unreachable code segments. - New cop
MethodCallParentheses
tracks unwanted braces in method calls. - New cop
UnusedLocalVariable
tracks unused local variables for each scope. - New cop
ShadowingOuterLocalVariable
tracks use of the same name as outer local variables for block arguments or block local variables. - New cop
WhileUntilDo
tracks uses ofdo
with multi-linewhile/until
. - New cop
CharacterLiteral
tracks uses of character literals (?x
). - New cop
EndInMethod
tracks uses ofEND
in method definitions. - New cop
LiteralInCondition
tracks uses of literals in the conditions ofif/while/until
. - New cop
BeginBlock
tracks uses ofBEGIN
blocks. - New cop
EndBlock
tracks uses ofEND
blocks. - New cop
DotPosition
tracks the dot position in multi-line method calls. - New cop
Attr
tracks uses ofModule#attr
. - Add support for auto-correction of some offences with
-a
/--auto-correct
.
- Deprecated
-e
/--emacs
option. (Use--format emacs
instead). - Made
progress
formatter the default. - Most formatters (
progress
,simple
andclang
) now print relative file paths if the paths are under the current working directory. - Migrate all cops to new namespaces.
Rubocop::Cop::Lint
is for cops that emit warnings.Rubocop::Cop::Style
is for cops that do not belong in other namespaces. - Merge
FavorPercentR
andPercentR
into one cop calledRegexpLiteral
, and add configuration parameterMaxSlashes
. - Add
CountKeywordArgs
configuration option toParameterLists
cop.
- #239: Fixed double quotes false positives.
- #233: Report syntax cop offences.
- Fix off-by-one error in favor_modifier.
- #229: Recognize a line with CR+LF as a blank line in AccessControl cop.
- #235: Handle multiple constant assignment in ConstantName cop.
- #246: Correct handling of unicode escapes within double quotes.
- Fix crashes in Blocks, CaseEquality, CaseIndentation, ClassAndModuleCamelCase, ClassMethods, CollectionMethods, and ColonMethodCall.
- #263: Do not check for space around operators called with method syntax.
- #271: Always allow line breaks inside hash literal braces.
- #270: Fixed a false positive in ParenthesesAroundCondition.
- #288: Get config parameter AllCops/Excludes from highest config file in path.
- #276: Let columns start at 1 instead of 0 in all output of column numbers.
- #292: Don't check non-regular files (like sockets, etc).
- Fix crashes in WordArray on arrays of character literals such as
[?\r, ?\n]
. - Fix crashes in Documentation on empty modules.
- Lock Parser dependency to version 2.0.0.beta5.
- New cop
BlockNesting
checks for excessive block nesting.
- Correct calculation of whether a modifier version of a conditional statement will fit.
- Fix an error in
MultilineIfThen
cop that occurred in some special cases. - #231: Fix a false positive for modifier if.
- New cop
Proc
tracks uses ofProc.new
.
- Renamed
NewLambdaLiteral
toLambda
. - Aligned the
Lambda
cop more closely to the style guide - it now allows the use oflambda
for multi-line blocks.
- #210: Fix a false positive for double quotes in regexp literals.
- #211: Fix a false positive for
initialize
method looking like a trivial writer. - #215: Fixed a lot of modifier
if/unless/while/until
issues. - #213: Make sure even disabled cops get their configuration set.
- #214: Fix SpaceInsideHashLiteralBraces to handle string interpolation right.
- Folded
ArrayLiteral
andHashLiteral
intoEmptyLiteral
cop. - The maximum number of params
ParameterLists
accepts in now configurable. - Reworked
SymbolSnakeCase
intoSymbolName
, which has an optionAllowCamelCase
enabled by default. - Migrated from
Ripper
to the portable Parser.
- New cop
ConstantName
checks for constant which are not usingSCREAMING_SNAKE_CASE
. - New cop
AccessControl
checks private/protected indentation and surrounding blank lines. - New cop
Loop
checks forbegin/end/while(until)
and suggests the use ofKernel#loop
.
- #155: 'Do not use semicolons to terminate expressions.' is not implemented correctly.
OpMethod
now handles definition of unary operators without crashing.SymbolSnakeCase
now handles aliasing of operators without crashing.RescueException
now handles the splat operator*
in arescue
clause without crashing.- #159: AvoidFor cop misses many violations.
- Added missing files to the gemspec.
- Added ability to include or exclude files/directories through
.rubocop.yml
. - Added option --only for running a single cop.
- Relax semicolon rule for one line methods, classes and modules.
- Configuration files, such as
.rubocop.yml
, can now include configuration from other files through theinherit_from
directive. All configuration files implicitly inherit fromconfig/default.yml
. - New cop
ClassMethods
checks for uses for class/module names in definitions of class/module methods. - New cop
SingleLineMethods
checks for methods implemented on a single line. - New cop
FavorJoin
checks for usages ofArray#*
with a string argument. - New cop
BlockComments
tracks uses of block comments(=begin/=end
comments). - New cop
EmptyLines
tracks consecutive blank lines. - New cop
WordArray
tracks arrays of words. - #108: New cop
SpaceInsideHashLiteralBraces
checks for spaces inside hash literal braces - style is configurable. - New cop
LineContinuation
tracks uses of the line continuation character (\
). - New cop
SymbolArray
tracks arrays of symbols. - Print warnings for unrecognized names in configuration files.
- New cop
TrivialAccessors
tracks method definitions that could be automatically generated withattr_*
methods. - New cop
LeadingCommentSpace
checks for missing space after#
in comments. - New cop
ColonMethodCall
tracks uses of::
for method calls. - New cop
AvoidGlobalVars
tracks uses of non built-in global variables. - New cop
SpaceAfterControlKeyword
tracks missing spaces afterif/elsif/case/when/until/unless/while
. - New cop
Not
tracks uses of thenot
keyword. - New cop
Eval
tracks uses of theeval
function.
- #101:
SpaceAroundEqualsInParameterDefault
doesn't work properly with empty string. - Fix
BraceAfterPercent
for%W
,%i
and%I
and added more tests. - Fix a false positive in the
Alias
cop.:alias
is no longer treated as keyword. ArrayLiteral
now properly detectsArray.new
.HashLiteral
now properly detectsHash.new
.VariableInterpolation
now detects regexp back references and doesn't crash.- Don't generate pathnames like some/project//some.rb.
- #151: Don't print the unrecognized cop warning several times for the same
.rubocop.yml
.
- Renamed
Indentation
cop toCaseIndentation
to avoid confusion. - Renamed
EmptyLines
cop toEmptyLineBetweenDefs
to avoid confusion.
- Split
AsciiIdentifiersAndComments
cop in two separate cops.
- #90: Two cops crash when scanning code using
super
. - #93: Issue with
whitespace?': undefined method
. - #97: Build fails.
- #100:
OpMethod
cop doesn't work if method arg is not in braces. SymbolSnakeCase
now tracks Ruby 1.9 hash labels as well as regular symbols.
- #88: Abort gracefully when interrupted with Ctrl-C.
- No longer crashes on bugs within cops. Now problematic checks are skipped and a message is displayed.
- Replaced
Term::ANSIColor
withRainbow
. - Add an option to disable colors in the output.
- Cop names are now displayed alongside messages when
-d/--debug
is passed.
- New cop
ReduceArguments
tracks argument names in reduce calls. - New cop
MethodLength
tracks number of LOC (lines of code) in methods. - New cop
RescueModifier
tracks uses ofrescue
in modifier form. - New cop
PercentLiterals
tracks uses of%q
,%Q
,%s
and%x
. - New cop
BraceAfterPercent
tracks uses of % literals with delimiters other than (). - Support for disabling cops locally in a file with rubocop:disable comments.
- New cop
EnsureReturn
tracks usages ofreturn
inensure
blocks. - New cop
HandleExceptions
tracks suppressed exceptions. - New cop
AsciiIdentifiersAndComments
tracks uses of non-ascii characters in identifiers and comments. - New cop
RescueException
tracks uses of rescuing theException
class. - New cop
ArrayLiteral
tracks uses of Array.new. - New cop
HashLiteral
tracks uses of Hash.new. - New cop
OpMethod
tracks the argument name in operator methods. - New cop
PercentR
tracks uses of %r literals with zero or one slash in the regexp. - New cop
FavorPercentR
tracks uses of // literals with more than one slash in the regexp.
- #62: Config files in ancestor directories are ignored if another exists in home directory.
- #65: Suggests to convert symbols
:==
,:<=>
and the like to snake_case. - #66: Does not crash on unreadable or unparseable files.
- #70: Support
alias
with bareword arguments. - #64: Performance issue with Bundler.
- #75: Make it clear that some global variables require the use of the English library.
- #79: Ternary operator missing whitespace detection.
- Dropped Jeweler for gem release management since it's no longer actively maintained.
- Handle pluralization properly in the final summary.
- New cop
FavorSprintf
that checks for usages ofString#%
. - New cop
Semicolon
that checks for usages of;
as expression separator. - New cop
VariableInterpolation
that checks for variable interpolation in double quoted strings. - New cop
Alias
that checks for uses of the keywordalias
. - Automatically detect extensionless Ruby files with shebangs when search for Ruby source files in a directory.