- #427 - FavorUnlessOverNegatedIf triggered when using elsifs
- #421 -
TrivialAccessors
now ignores methods on user-configurable whitelist (such asto_s
andto_hash
) - New option
--auto-gen-config
outputs RuboCop configuration that disables all cops that detect any offences (for #369). - 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
.
- 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