- #4448: Add new
TapFormatter
. (@cyberdelia) - Add new
Style/HeredocDelimiters
cop. (@drenmi) - #4153: New cop
Lint/ReturnInVoidContext
checks for the use of a return with a value in a context where it will be ignored. (@harold-s) - Add auto-correct support to
Lint/ScriptPermission
. (@rrosenblum) - #4514: Add configuration options to
Style/YodaCondition
to support checking all comparison operators or equality operators only. (@smakagon) - Add new
Lint/BooleanSymbol
cop. (@droptheplot) - Make
Rails/PluralizationGrammar
use singular methods for-1
/-1.0
. (@promisedlandt) - #4541: Add new
Rails/HasManyOrHasOneDependent
cop. (@oboxodo) - Add new
Style/Dir
cop. (@drenmi) - Add new
Style/HeredocDelimiterCase
cop. (@drenmi) - #2943: Add new
Lint/RescueWithoutErrorClass
cop. (@drenmi) - #4568: Fix autocorrection for
Style/TrailingUnderscoreVariable
. (@smakagon) - #4586: Add new
Performance/UnfreezeString
cop. (@pocke) - #2976: Add
Whitelist
configuration option toStyle/NestedParenthesizedCalls
cop. (@drenmi)
- #4604: Fix
Style/LambdaCall
to autocorrectobj.call
toobj.
. (@iGEL) - #4443: Prevent
Style/YodaCondition
from breakingnot LITERAL
. (@pocke) - #4434: Prevent bad auto-correct in
Style/Alias
for non-literal arguments. (@drenmi) - #4451: Make
Style/AndOr
cop aware of comparison methods. (@drenmi) - #4457: Fix false negative in
Lint/Void
with initialize and setter methods. (@pocke) - #4418: Register an offense in
Style/ConditionalAssignment
when the assignment line is the longest line, and it does not exceed the max line length. (@rrosenblum) - #4491: Prevent bad auto-correct in
Style/EmptyElse
for nestedif
. (@pocke) - #4485: Handle 304 status for remote config files. (@daniloisr)
- #4529: Make
Lint/UnreachableCode
aware ofif
andcase
. (@pocke) - #4469: Include permissions in file cache. (@pocke)
- #4270: Fix false positive in
Performance/RegexpMatch
for named captures. (@pocke) - #4525: Fix regexp for checking comment config of
rubocop:disable all
inLint/UnneededDisable
. (@meganemura) - #4555: Make
Style/VariableName
aware of optarg, kwarg and other arguments. (@pocke) - #4481: Prevent
Style/WordArray
andStyle/SymbolArray
from registering offenses where percent arrays don't work. (@drenmi) - #4447: Prevent
Layout/EmptyLineBetweenDefs
from removing too many lines. (@drenmi) - #3892: Make
Style/NumericPredicate
ignore numeric comparison of global variables. (@drenmi) - #4101: Skip auto-correct for literals with trailing comment and chained method call in
Layout/Multiline*BraceLayout
. (@jonas054) - #4518: Fix bug where
Style/SafeNavigation
does not register an offense when there are chained method calls. (@rrosenblum) - #3040: Ignore safe navigation in
Rails/Delegate
. (@cgriego) - #4587: Fix false negative for void unary operators in
Lint/Void
cop. (@pocke) - #4589: Fix false positive in
Performance/RegexpMatch
cop for=~
is in a class method. (@pocke) - #4578: Fix false positive in
Lint/FormatParameterMismatch
for format with "asterisk" (*
) width and precision. (@smakagon) - #4285: Make
Lint/DefEndAlignment
aware of multiple modifiers. (@drenmi)
- #4553: Add
node_modules
to default excludes. (@iainbeeston) - #4444: Make
Style/Encoding
cop enabled by default. (@deivid-rodriguez) - #4452: Add option to
Rails/Delegate
for enforcing the prefixed method name case. (@klesse413) - #4493: Make
Lint/Void
cop aware ofEnumerable#each
andfor
. (@pocke) - #4492: Make
Lint/DuplicateMethods
aware ofalias
andalias_method
. (@pocke) - #4478: Fix confusing message of
Performance/Caller
cop. (@pocke) - #4543: Make
Lint/DuplicateMethods
aware ofattr_*
methods. (@pocke) - #4550: Mark
RuboCop::CLI#run
as a public API. (@yujinakayama) - #4551: Make
Performance/Caller
aware ofcaller_locations
. (@pocke) - Rename
Style/HeredocDelimiters
toStyle/HeredocDelimiterNaming
. (@drenmi) - #4157: Enhance offense message for
Style/RedudantReturn
cop. (@gohdaniel15) - #4521: Move naming related cops into their own
Naming
department. (@drenmi)
- #4411: Handle properly safe navigation in
Style/YodaCondition
. (@bbatsov) - #4412: Handle properly literal comparisons in
Style/YodaCondition
. (@bbatsov) - Handle properly class variables and global variables in
Style/YodaCondition
. (@bbatsov) - #4392: Fix the auto-correct of
Style/Next
when theend
is misaligned. (@rrosenblum) - #4407: Prevent
Performance/RegexpMatch
from blowing up onmatch
without arguments. (@pocke) - #4414: Handle pseudo-assignments in
for
loops inStyle/ConditionalAssignment
. (@bbatsov) - #4419: Handle combination
AllCops: DisabledByDefault: true
andRails: Enabled: true
. (@jonas054) - #4422: Fix missing space in message for
Style/MultipleComparison
. (@timrogers) - #4420: Ensure
Style/EmptyMethod
honours indentation when auto-correcting. (@drenmi) - #4442: Prevent
Style/WordArray
from breaking on strings that aren't valid UTF-8. (@pocke) - #4441: Prevent
Layout/SpaceAroundBlockParameters
from breaking on lambda. (@pocke)
- #117: Add
--parallel
option for running RuboCop in multiple processes or threads. (@jonas054) - Add auto-correct support to
Style/MixinGrouping
. (@rrosenblum) - #4236: Add new
Rails/ApplicationJob
andRails/ApplicationRecord
cops. (@tjwp) - #4078: Add new
Performance/Caller
cop. (@alpaca-tc) - #4314: Check slow hash accessing in
Array#sort
byPerformance/CompareWithBlock
. (@pocke) - #3438: Add new
Style/FormatStringToken
cop. (@backus) - #4342: Add new
Lint/ScriptPermission
cop. (@yhirano55) - #4145: Add new
Style/YodaCondition
cop. (@smakagon) - #4403: Add public API
Cop.autocorrect_incompatible_with
for specifying other cops that should not autocorrect together. (@backus) - #4354: Add autocorrect to
Style/FormatString
. (@hoshinotsuyoshi) - #4021: Add new
Style/MultipleComparison
cop. (@dabroz) - New
Lint/RescueType
cop. (@rrosenblum)
- #4262: Add new
MinSize
configuration toStyle/SymbolArray
, consistent with the same configuration inStyle/WordArray
. (@scottmatthewman) - #3400: Remove auto-correct support from Lint/Debugger. (@ilansh)
- #4278: Move all cops dealing with whitespace into a new department called
Layout
. (@jonas054) - #4320: Update
Rails/OutputSafety
to disallow wrappingraw
orhtml_safe
withsafe_join
. (@klesse413) - #4336: Store
rubocop_cache
in safer directories. (@jonas054) - #4361: Use relative path for offense message in
Lint/DuplicateMethods
. (@pocke) - #4385: Include
.jb
file by default. (@pocke)
- #4265: Require a space before first argument of a method call in
Style/SpaceBeforeFirstArg
cop. (@cjlarose) - #4237: Fix false positive in
Lint/AmbiguousBlockAssociation
cop for lambdas. (@smakagon) - #4242: Add
Capfile
to the list of known Ruby filenames. (@bbatsov) - #4240: Handle
||=
inRails/RelativeDateConstant
. (@bbatsov) - #4241: Prevent
Rails/Blank
andRails/Present
from breaking when there is no explicit receiver. (@rrosenblum) - #4249: Handle multiple assignment in
Rails/RelativeDateConstant
. (@bbatsov) - #4250: Improve a bit the Ruby code detection config. (@bbatsov)
- #4283: Fix
Style/EmptyCaseCondition
autocorrect bug - when firstwhen
branch includes comma-delimited alternatives. (@ilansh) - #4268: Handle end-of-line comments when autocorrecting Style/EmptyLinesAroundAccessModifier. (@vergenzt)
- #4275: Prevent
Style/MethodCallWithArgsParentheses
from blowing up onyield
. (@drenmi) - #3969: Handle multiline method call alignment for arguments to methods. (@jonas054)
- #4304: Allow enabling whole departments when
DisabledByDefault
istrue
. (@jonas054) - #4264: Prevent
Rails/SaveBang
from blowing up when using the assigned variable in a hash. (@drenmi) - #4310: Treat paths containing invalid byte sequences as non-matches. (@mclark)
- #4063: Fix Rails/ReversibleMigration misdetection. (@gprado)
- #4339: Fix false positive in
Security/Eval
cop for multiline string lietral. (@pocke) - #4339: Fix false negative in
Security/Eval
cop forBinding#eval
. (@pocke) - #4327: Prevent
Layout/SpaceInsidePercentLiteralDelimiters
from registering offenses on execute-strings. (@drenmi) - #4371: Prevent
Style/MethodName
from complaining about unary operator definitions. (@drenmi) - #4366: Prevent
Performance/RedundantMerge
from blowing up on double splat arguments. (@drenmi) - #4352: Fix the auto-correct of
Style/AndOr
when Enumerable accessors ([]
) are used. (@rrosenblum) - #4393: Prevent
Style/InverseMethods
from registering an offense for methods that are double negated. (@rrosenblum) - #4394: Prevent some cops from breaking on safe navigation operator. (@drenmi)
- #4260: Prevent
Rails/SkipsModelValidations
from registering an offense forFileUtils.touch
. (@rrosenblum)
- #4219: Add a link to style guide for
Style/IndentationConsistency
cop. (@pocke) - #4168: Removed
-n
option. (@sadovnik) - #4039: Change
Style/PercentLiteralDelimiters
default configuration to match Style Guide update. (@drenmi) - #4235: Improved copy of offense message in
Lint/AmbiguousBlockAssociation
cop. (@smakagon)
- #4171: Prevent
Rails/Blank
from breaking when RHS ofor
is a naked falsiness check. (@drenmi) - #4189: Make
Lint/AmbiguousBlockAssociation
aware of lambdas passed as arguments. (@drenmi) - #4179: Prevent
Rails/Blank
from breaking when LHS ofor
is a naked falsiness check. (@rrosenblum) - #4172: Fix false positives in
Style/MixinGrouping
cop. (@drenmi) - #4185: Make
Lint/NestedMethodDefinition
aware of#*_exec
class of methods. (@drenmi) - #4197: Fix false positive in
Style/RedundantSelf
cop with parallel assignment. (@drenmi) - #4199: Fix incorrect auto correction in
Style/SymbolArray
andStyle/WordArray
cop. (@pocke) - #4218: Make
Lint/NestedMethodDefinition
aware of class shovel scope. (@drenmi) - #4198: Make
Lint/AmbguousBlockAssociation
aware of operator methods. (@drenmi) - #4152: Make
Style/MethodCallWithArgsParentheses
not require parens on setter methods. (@drenmi) - #4226: Show in
--help
output that--stdin
takes a file name argument. (@jonas054) - #4217: Fix false positive in
Rails/FilePath
cop with non string argument. (@soutaro) - #4106: Make
Style/TernaryParentheses
unsafe autocorrect detector aware of literals and constants. (@drenmi) - #4228: Fix false positive in
Lint/AmbiguousBlockAssociation
cop. (@smakagon) - #4234: Fix false positive in
Rails/RelativeDate
for lambdas and procs. (@smakagon)
- #4107: New
TargetRailsVersion
configuration parameter can be used to specify which version of Rails the inspected code is intended to run on. (@maxbeizer) - #4104: Add
prefix
andpostfix
styles toStyle/NegatedIf
. (@brandonweiss) - #4083: Add new configuration
NumberOfEmptyLines
forStyle/EmptyLineBetweenDefs
. (@dorian) - #4045: Add new configuration
Strict
forStyle/NumericLiteral
to make the change to this cop in 0.47.0 configurable. (@iGEL) - #4005: Add new
AllCops/EnabledByDefault
option. (@betesh) - #3893: Add a new configuration,
IncludeActiveSupportAliases
, toPerformance/DoublStartEndWith
. This configuration will check for ActiveSupport'sstarts_with?
andends_with?
. (@rrosenblum) - #3889: Add new
Style/EmptyLineAfterMagicComment
cop. (@backus) - #3800: Make
Style/EndOfLine
configurable withlf
,crlf
, andnative
(default) styles. (@jonas054) - #3936: Add new
Style/MixinGrouping
cop. (@drenmi) - #4003: Add new
Rails/RelativeDateConstant
cop. (@sinsoku) - #3984: Add new
Style/EmptyLinesAroundBeginBody
cop. (@pocke) - #3995: Add new
Style/EmptyLinesAroundExceptionHandlingKeywords
cop. (@pocke) - #4019: Make configurable
Style/MultilineMemoization
cop. (@pocke) - #4018: Add autocorrect
Lint/EmptyEnsure
cop. (@pocke) - #4028: Add new
Style/IndentHeredoc
cop. (@pocke) - #3931: Add new
Lint/AmbiguousBlockAssociation
cop. (@smakagon) - Add new
Style/InverseMethods
cop. (@rrosenblum) - #4038: Allow
default
key in theStyle/PercentLiteralDelimiters
cop config to set all preferred delimiters. (@kddeisz) - Add
IgnoreMacros
option toStyle/MethodCallWithArgsParentheses
. (@drenmi) - #3937: Add new
Rails/ActiveSupportAliases
cop. (@tdeo) - Add new
Rails/Blank
cop. (@rrosenblum) - Add new
Rails/Present
cop. (@rrosenblum) - #4004: Allow not treating comment lines as group separators in
Bundler/OrderedGems
cop. (@konto-andrzeja)
- #4100: Rails/SaveBang should flag
update_attributes
. (@andriymosin) - #4083:
Style/EmptyLineBetweenDefs
doesn't allow more than one empty line between method definitions by default (seeNumberOfEmptyLines
). (@dorian) - #3997: Include all ruby files by default and exclude non-ruby files. (@dorian)
- #4012: Mark
foo[:bar]
as not complex inStyle/TernaryParentheses
cop withrequire_parentheses_when_complex
style. (@onk) - #3915: Make configurable whitelist for
Lint/SafeNavigationChain
cop. (@pocke) - #3944: Allow keyword arguments in
Style/RaiseArgs
cop. (@mikegee) - Add auto-correct to
Performance/DoubleStartEndWith
. (@rrosenblum) - #3951: Make
Rails/Date
cop to register an offence for a string without timezone. (@sinsoku) - #4020: Fixed
new_cop.rake
suggested path. (@dabroz) - #4055: Add parameters count to offense message for
Metrics/ParameterLists
cop. (@pocke) - #4081: Allow
Marshal.load
if argument is aMarshal.dump
inSecurity/MarshalLoad
cop. (@droptheplot) - #4124: Make
Style/SymbolArray
cop to enable by default. (@pocke) - #3331: Change
Style/MultilineMethodCallIndentation
indented_relative_to_receiver
to indent relative to the reciever and not relative to the caller. (@jfelchner) - #4137: Allow lines to be exempted from
IndentationWidth
by regex. (@jfelchner)
- #4007: Skip
Rails/SkipsModelValidations
for methods that don't accept arguments. (@dorian) - #3923: Allow asciibetical sorting in
Bundler/OrderedGems
. (@mikegee) - #3855: Make
Lint/NonLocalExitFromIterator
aware of method definitions. (@drenmi) - #2643: Allow uppercase and dashes in
MagicComment
. (@mikegee) - #3959: Don't wrap "percent arrays" with extra brackets when autocorrecting
Style/MutableConstant
. (@mikegee) - #3978: Fix false positive in
Performance/RegexpMatch
withEnglish
module. (@pocke) - #3242: Ignore
Errno::ENOENT
during cache cleanup fromFile.mtime
too. (@mikegee) - #3958:
Style/SpaceInsideHashLiteralBraces
doesn't add and offence when checking an hash where a value is a left brace string (e.g. { k: '{' }). (@nodo) - #4006: Prevent
Style/WhileUntilModifier
from breaking on a multiline modifier. (@drenmi) - #3345: Allow
Style/WordArray
'sWordRegex
configuration value to be an instance ofString
. (@mikegee) - #4013: Follow redirects for RemoteConfig. (@buenaventure)
- #3917: Rails/FilePath Match nodes in a method call only once. (@unmanbearpig)
- #3673: Fix regression on
Style/RedundantSelf
when assigning to same local variable. (@bankair) - #4047: Allow
find_zone
andfind_zone!
methods inRails/TimeZone
. (@attilahorvath) - #3457: Clear a warning and prevent new warnings. (@mikegee)
- #4066: Register an offense in
Lint/ShadowedException
when an exception is shadowed and there is an implicit begin. (@rrosenblum) - #4001: Lint/UnneededDisable of Metrics/LineLength that isn't unneeded. (@wkurniawan07)
- #3960: Let
Include
/Exclude
paths in all files beginning with.rubocop
be relative to the configuration file's directory and not to the current directory. (@jonas054) - #4049: Bugfix for
Style/EmptyLiteral
cop. (@ota42y) - #4112: Fix false positives about double quotes in
Style/StringLiterals
,Style/UnneededCapitalW
andStyle/UnneededPercentQ
cops. (@pocke) - #4109: Fix incorrect auto correction in
Style/SelfAssignment
cop. (@pocke) - #4110: Fix incorrect auto correction in
Style/BracesAroundHashParameters
cop. (@musialik) - #4084: Fix incorrect auto correction in
Style/TernaryParentheses
cop. (@musialik) - #4102: Fix
Security/JSONLoad
,Security/MarshalLoad
andSecurity/YAMLLoad
cops patterns not matching ::Const. (@musialik) - #3580: Handle combinations of
# rubocop:disable all
and# rubocop:disable SomeCop
. (@jonas054) - #4124: Fix auto correction bugs in
Style/SymbolArray
cop. (@pocke) - #4128: Prevent
Style/CaseIndentation
cop from registering offenses on single-line case statements. (@drenmi) - #4143: Prevent
Style/IdenticalConditionalBranches
from registering offenses when a case statement has an empty when. (@dpostorivo) - #4160: Fix a regression where
UselessAssignment
cop may not properly detect useless assignments when there's only a single conditional expression in the top level scope. (@yujinakayama) - #4162: Fix a false negative in
UselessAssignment
cop with nested conditionals. (@yujinakayama)
- #3911: Prevent a crash in
Performance/RegexpMatch
cop with module definition. (@pocke) - #3908: Prevent
Style/AlignHash
from breaking on a keyword splat when using enforcedtable
style. (@drenmi) - #3918: Prevent
Rails/EnumUniqueness
from breaking on a non-literal hash value. (@drenmi) - #3914: Fix department resolution for third party cops required through configuration. (@backus)
- #3846:
NodePattern
works for hyphenated node types. (@alexdowad) - #3922: Prevent
Style/NegatedIf
from breaking on negated ternary. (@drenmi) - #3915: Fix a false positive in
Lint/SafeNavigationChain
cop withtry
method. (@pocke)
- #3822: Add
Rails/FilePath
cop. (@iguchi1124) - #3821: Add
Security/YAMLLoad
cop. (@cyberdelia) - #3816: Add
Security/MarshalLoad
cop. (@cyberdelia) - #3757: Add Auto-Correct for
Bundler/OrderedGems
cop. (@pocke) Style/FrozenStringLiteralComment
now supports the stylenever
that will remove thefrozen_string_literal
comment. (@rrosenblum)- #3795: Add
Lint/MultipleCompare
cop. (@pocke) - #3772: Allow exclusion of certain methods for
Metrics/BlockLength
. (@NobodysNightmare) - #3804: Add new
Lint/SafeNavigationChain
cop. (@pocke) - #3670: Add
CountBlocks
boolean option toMetrics/BlockNesting
. It allows blocks to be counted towards the nesting limit. (@georgyangelov) - #2992: Add a configuration to
Style/ConditionalAssignment
to toggle offenses for ternary expressions. (@rrosenblum) - #3824: Add new
Perfomance/RegexpMatch
cop. (@pocke) - #3825: Add new
Rails/SkipsModelValidations
cop. (@rahulcs) - #3737: Add new
Style/MethodCallWithArgsParentheses
cop. (@dominh) - Renamed
MethodCallParentheses
toMethodCallWithoutArgsParentheses
. (@dominh) - #3854: Add new
Rails/ReversibleMigration
cop. (@sue445) - #3872: Detect
String#%
with hash literal. (@backus) - #2731: Allow configuration of method calls that create methods for
Lint/UselessAccessModifier
. (@pat)
- #3820: Rename
Lint/Eval
toSecurity/Eval
. (@cyberdelia) - #3725: Disable
Style/SingleLineBlockParams
by default. (@tejasbubane) - #3765: Add a validation for supported styles other than EnforcedStyle.
AlignWith
,IndentWhenRelativeTo
andEnforcedMode
configurations are renamed. (@pocke) - #3782: Add check for
add_reference
method byRails/NotNullColumn
cop. (@pocke) - #3761: Update
Style/RedundantFreeze
message fromFreezing immutable objects is pointless.
toDo not freeze immutable objects, as freezing them has no effect.
. (@lucasuyezu) - #3753: Change error message of
Bundler/OrderedGems
to mentionAlphabetize Gems
. (@tejasbubane) - #3802: Ignore case when checking Gemfile order. (@breckenedge)
- Add missing examples in
Lint
cops documentation. (@enriikke) - Make
Style/EmptyMethod
cop aware of class methods. (@drenmi) - #3871: Add check for void
defined?
andself
byLint/Void
cop. (@pocke) - Allow ignoring methods in
Style/BlockDelimiters
when using any style. (@twe4ked)
- #3751: Avoid crash in
Rails/EnumUniqueness
cop. (@pocke) - #3766: Avoid crash in
Style/ConditionalAssignment
cop with masgn. (@pocke) - #3770:
Style/RedundantParentheses
Don't flag raised to a power negative numeric literals, since removing the parentheses would change the meaning of the expressions. (@amogil) - #3750: Register an offense in
Style/ConditionalAssignment
when the assignment spans multiple lines. (@rrosenblum) - #3775: Avoid crash in
Style/HashSyntax
cop with an empty hash. (@pocke) - #3783: Maintain parentheses in
Rails/HttpPositionalArguments
when methods are defined with them. (@kevindew) - #3786: Avoid crash
Style/ConditionalAssignment
cop with mass assign method. (@pocke) - #3749: Detect corner case of
Style/NumericLitterals
. (@kamaradclimber) - #3788: Prevent bad auto-correct in
Style/Next
when block has nested conditionals. (@drenmi) - #3807: Prevent
Style/Documentation
andStyle/DocumentationMethod
from mistaking RuboCop directives for class documentation. (@drenmi) - #3815: Fix false positive in
Style/IdenticalConditionalBranches
cop when branches have same line at leading. (@pocke) - Fix false negative in
Rails/HttpPositionalArguments
where offense would go undetected if one of the request parameter names matched one of the special keyword arguments. (@deivid-rodriguez) - Fix false negative in
Rails/HttpPositionalArguments
where offense would go undetected if the:format
keyword was used with other non-special keywords. (@deivid-rodriguez) - #3406: Enable cops if Enabled is not explicitly set to false. (@metcalf)
- Fix
Lint/FormatParameterMismatch
for splatted last argument. (@zverok) - #3853: Fix false positive in
RedundantParentheses
cop with multiple expression. (@pocke) - #3870: Avoid crash in
Rails/HttpPositionalArguments
. (@pocke) - #3869: Prevent
Lint/FormatParameterMismatch
from breaking when#%
is passed an empty array. (@drenmi) - #3879: Properly handle Emacs and Vim magic comments for
FrozenStringLiteralComment
. (@backus) - #3736: Fix to remove accumulator return value by auto-correction in
Style/EachWithObject
. (@pocke)
- #3600: Add new
Bundler/DuplicatedGem
cop. (@jmks) - #3624: Add new configuration option
empty_lines_special
toStyle/EmptyLinesAroundClassBody
andStyle/EmptyLinesAroundModuleBody
. (@legendetm) - Add new
Style/EmptyMethod
cop. (@drenmi) Style/EmptyLiteral
will now auto-correctHash.new
when it is the first argument being passed to a method. The arguments will be wrapped with parenthesis. (@rrosenblum)- #3713: Respect
DisabledByDefault
in parent configs. (@aroben) - New cop
Rails/EnumUniqueness
checks for duplicate values defined in enum config. (@olliebennett) - New cop
Rails/EnumUniqueness
checks for duplicate values defined in enum config hash. (@olliebennett) - #3451: Add new
require_parentheses_when_complex
style toStyle/TernaryParentheses
cop. (@swcraig) - #3600: Add new
Bundler/OrderedGems
cop. (@tdeo) - #3479: Add new configuration option
IgnoredPatterns
toMetrics/LineLength
. (@jonas054)
- The offense range for
Performance/FlatMap
now includes any parameters that are passed toflatten
. (@rrosenblum) - #1747: Update
Style/SpecialGlobalVars
messages with a reminder torequire 'English'
. (@ivanovaleksey) - Checks
binding.irb
call byLint/Debugger
cop. (@pocke) - #3742: Checks
min
andmax
call byPerfomance/CompareWithBlock
cop. (@pocke)
- #3662: Fix the auto-correction of
Lint/UnneededSplatExpansion
when the splat expansion is inside of another array. (@rrosenblum) - #3699: Fix false positive in
Style/VariableNumber
on variable names ending with an underscore. (@bquorning) - #3687: Fix the fact that
Style/TernaryParentheses
cop claims to correct uncorrected offenses. (@Ana06) - #3568: Fix
--auto-gen-config
behavior forStyle/VariableNumber
. (@jonas054) - Add
format
as an acceptable keyword argument forRails/HttpPositionalArguments
. (@aesthetikx) - #3598: In
Style/NumericPredicate
, don't reportx != 0
orx.nonzero?
as the expressions have different values. (@jonas054) - #3690: Do not register an offense for multiline braces with content in
Style/SpaceInsideBlockBraces
. (@rrosenblum) - #3746:
Lint/NonLocalExitFromIterator
does not warn aboutreturn
in a block which is passed toObject#define_singleton_method
. (@AlexWayfer)
- #3615: Add autocorrection for
Lint/EmptyInterpolation
. (@pocke) - Make
PercentLiteralDelimiters
enforce delimiters around%I()
too. (@bronson) - #3408: Add check for repeated values in case conditionals. (@swcraig)
- #3646: Add new
Lint/EmptyWhen
cop. (@drenmi) - #3246: Add list of all cops to the manual (generated automatically from a rake task). (@sihu)
- #3647: Add
--force-default-config
option. (@jawshooah) - #3570: Add new
MultilineIfModifier
cop to avoid usage of if/unless-modifiers on multiline statements. (@tessi) - #3631: Add new
Style/SpaceInLambdaLiteral
cop to check for spaces in lambda literals. (@swcraig) - Add new
Lint/EmptyExpression
cop. (@drenmi)
- #3553: Make
Style/RedundantSelf
cop to not register an offence forself.()
. (@iGEL) - #3474: Make the
Rails/TimeZone
only analyze functions which have "Time" in the receiver. (@b-t-g) - #3607: Fix
Style/RedundantReturn
cop for empty if body. (@pocke) - #3291: Improve detection of
raw
andhtml_safe
methods inRails/OutputSafety
. (@lumeet) - Redundant return style now properly handles empty
when
blocks. (@albus522) - #3622: Fix false positive for
Metrics/MethodLength
andMetrics/BlockLength
. (@meganemura) - #3625: Fix some cops errors when condition is empty brace. (@pocke)
- #3468: Fix bug regarding alignment inside
begin
..end
block inStyle/MultilineMethodCallIndentation
. (@jonas054) - #3644: Fix generation incorrect documentation. (@pocke)
- #3637: Fix Style/NonNilCheck crashing for ternary condition. (@tejasbubane)
- #3654: Add missing keywords for
Rails/HttpPositionalArguments
. (@eitoball) - #3652: Avoid crash Rails/HttpPositionalArguments for lvar params when auto-correct. (@pocke)
- Fix bug in
Style/SafeNavigation
where there is a check for an object in an elsif statement with a method call on that object in the branch. (@rrosenblum) - #3660: Fix false positive for Rails/SafeNavigation when without receiver. (@pocke)
- #3650: Fix
Style/VariableNumber
registering an offense for variables with double digit numbers. (@rrosenblum) - #3494: Check
rails
style indentation also inside blocks inStyle/IndentationWidth
. (@jonas054) - #3676: Ignore raw and html_safe invocations when wrapped inside a safe_join. (@b-t-g)
- #3601: Change default args for
Style/SingleLineBlockParams
. This cop checks thatreduce
andinject
use the variable namesa
ande
for block arguments. These defaults are uncommunicative variable names and thus conflict with the "Uncommunicative Variable Name" check in Reek. Default args changed toacc
andelem
.(@jessieay) - #3645: Fix bug with empty case when nodes in
Style/RedundantReturn
. (@tiagocasanovapt) - #3263: Fix auto-correct of if statements inside of unless else statements in
Style/ConditionalAssignment
. (@rrosenblum) - Bump default Ruby version to 2.1. (@drenmi)
- Remove a debug
require
. (@bbatsov)
- #3560: Add a configuration option
empty_lines_except_namespace
toStyle/EmptyLinesAroundClassBody
andStyle/EmptyLinesAroundModuleBody
. (@legendetm) - #3370: Add new
Rails/HttpPositionalArguments
cop to check your Rails 5 test code for existence of positional args usage. (@logicminds) - #3510: Add a configuration option,
ConvertCodeThatCanStartToReturnNil
, toStyle/SafeNavigation
to check for code that could start returningnil
if safe navigation is used. (@rrosenblum) - Add a new
AllCops/StyleGuideBaseURL
setting that allows the use of relative paths and/or fragments within each cop'sStyleGuide
setting, to make forking of custom style guides easier. (@scottmatthewman) - #3566: Add new
Metric/BlockLength
cop to ensure blocks don't get too long. (@savef) - #3428: Add support for configuring
Style/PreferredHashMethods
with eithershort
orverbose
style method names. (@abrom) - #3455: Add new
Rails/DynamicFindBy
cop. (@pocke) - #3542: Add a configuration option,
IgnoreCopDirectives
, toMetrics/LineLength
to stop cop directives (# rubocop:disable Metrics/AbcSize
) from being counted when considering line length. (@jmks) - Add new
Rails/DelegateAllowBlank
cop. (@connorjacobsen) - Add new
Style/MultilineMemoization
cop. (@drenmi)
- #3103: Make
Style/ExtraSpacing
cop register an offense for extra spaces present in single-line hash literals. (@tcdowney) - #3513: Fix false positive in
Style/TernaryParentheses
for a ternary with ranges. (@dreyks) - #3520: Fix regression causing
Lint/AssignmentInCondition
false positive. (@savef) - #3514: Make
Style/VariableNumber
cop not register an offense when valid normal case variable names have an integer after the first_
. (@b-t-g) - #3516: Make
Style/VariableNumber
cop not register an offense when valid normal case variable names have an integer in the middle. (@b-t-g) - #3436: Make
Rails/SaveBang
cop not register an offense when return value of a non-bang method is returned by the parent method. (@coorasse) - #3540: Fix
Style/GuardClause
to register offense for instance and singleton methods. (@tejasbubane) - #3311: Detect incompatibilities with the external encoding to prevent bad autocorrections in
Style/StringLiterals
. (@deivid-rodriguez) - #3499: Ensure
Lint/UnusedBlockArgument
doesn't make recommendations that would change arity for methods defined using#define_method
. (@drenmi) - #3430: Fix exception in
Performance/RedundantMerge
when inspecting a#merge!
with implicit receiver. (@drenmi) - #3411: Avoid auto-correction crash for single
when
inPerformance/CaseWhenSplat
. (@jonas054) - #3286: Allow
self.a, self.b = b, a
inStyle/ParallelAssignment
. (@jonas054) - #3419: Report offense for
unless x.nil?
inStyle/NonNilCheck
ifIncludeSemanticChanges
istrue
. (@jonas054) - #3382: Avoid auto-correction crash for multiple elsifs in
Style/EmptyElse
. (@lumeet) - #3334: Do not register an offense for a literal space (
\s
) inStyle/UnneededCapitalW
. (@rrosenblum) - #3390: Fix SaveBang cop for multiple conditional. (@tejasbubane)
- #3577: Fix
Style/RaiseArgs
not allowing compact raise with splatted args. (@savef) - #3578: Fix safe navigation method call counting in
Metrics/AbcSize
. (@savef) - #3592: Fix
Style/RedundantParentheses
for indexing with literals. (@thegedge) - #3597: Fix the autocorrect of
Performance/CaseWhenSplat
when trying to rearange splat expanded variables to the end of a when condition. (@rrosenblum)
- #3512: Change error message of
Lint/UnneededSplatExpansion
for array in method parameters. (@tejasbubane) - #3510: Fix some issues with
Style/SafeNavigation
. Fix auto-correct of multiline if expressions, and do not register an offense for scenarios using||
and ternary expression. (@rrosenblum) - #3503: Change misleading message of
Style/EmptyLinesAroundAccessModifier
. (@bquorning) - #3407: Turn off autocorrect for unsafe rules by default. (@ptarjan)
- #3521: Turn off autocorrect for
Security/JSONLoad
by default. (@savef) - #2903:
Style/RedundantReturn
looks for redundantreturn
inside conditional branches. (@lumeet)
- #3379: Add table of contents at the beginning of HTML formatted output. (@hedgesky)
- #2968: Add new
Style/DocumentationMethod
cop. (@sooyang) - #3360: Add
RequireForNonPublicMethods
configuration option toStyle/DocumentationMethod
cop. (@drenmi) - Add new
Rails/SafeNavigation
cop to converttry!
to&.
. (@rrosenblum) - #3415: Add new
Rails/NotNullColumn
cop. (@pocke) - #3167: Add new
Style/VariableNumber
cop. (@sooyang) - Add new style
no_mixed_keys
toStyle/HashSyntax
to only check for hashes with mixed keys. (@daviddavis) - Allow including multiple configuration files from a single gem. (@tjwallace)
- Add check for
persisted?
method call when using a create method inRails/SaveBang
. (@QuinnHarris) - Add new
Style/SafeNavigation
cop to convert method calls safeguarded by a nonnil
check for the object to&.
. (@rrosenblum) - Add new
Performance/SortWithBlock
cop to usesort_by(&:foo)
instead ofsort_by { |a, b| a.foo <=> b.foo }
. (@koic) - #3492: Add new
UnifiedInteger
cop. (@pocke)
- #3383: Fix the local variable reset issue with
Style/RedundantSelf
cop. (@bankair) - #3445: Fix bad autocorrect for
Style/AndOr
cop. (@mikezter) - #3349: Fix bad autocorrect for
Style/Lambda
cop. (@metcalf) - #3351: Fix bad auto-correct for
Performance/RedundantMatch
cop. (@annaswims) - #3347: Prevent infinite loop in
Style/TernaryParentheses
cop when used together withStyle/RedundantParentheses
. (@drenmi) - #3209: Remove faulty line length check from
Style/GuardClause
cop. (@drenmi) - #3366: Make
Style/MutableConstant
cop aware of splat assignments. (@drenmi) - #3372: Fix RuboCop crash with empty brackets in
Style/Next
cop. (@pocke) - #3358: Make
Style/MethodMissing
cop aware of class scope. (@drenmi) - #3342: Fix error in
Lint/ShadowedException
cop if last rescue does not have parameter. (@soutaro) - #3380: Fix false positive in
Style/TrailingUnderscoreVariable
cop. (@drenmi) - #3388: Fix bug where
Lint/ShadowedException
would register an offense when rescuing different numbers of custom exceptions in multiple rescue groups. (@rrosenblum) - #3386: Make
VariableForce
understand an empty RegExp literal as LHS to=~
. (@drenmi) - #3421: Fix clobbering
inherit_from
additions when not using Namespaces in the configs. (@nicklamuro) - #3425: Fix bug for invalid bytes in UTF-8 in
Lint/PercentStringArray
cop. (@pocke) - #3374: Make
SpaceInsideBlockBraces
andSpaceBeforeBlockBraces
not depend onBlockDelimiters
configuration. (@jonas054) - Fix error in
Lint/ShadowedException
cop for higher number of rescue groups. (@groddeck) - #3456: Don't crash on a multiline empty brace in
Style/MultilineMethodCallBraceLayout
. (@pocke) - #3423: Checks if .rubocop is a file before parsing. (@joejuzl)
- #3439: Fix variable assignment check not working properly when a block is used in
Rails/SaveBang
. (@QuinnHarris) - #3401: Read file contents in binary mode so
Style/EndOfLine
works on Windows. (@jonas054) - #3450: Prevent
Style/TernaryParentheses
cop from making unsafe corrections. (@drenmi) - #3460: Fix false positives in
Style/InlineComment
cop. (@drenmi) - #3485: Make OneLineConditional cop not register offense for empty else. (@tejasbubane)
- #3508: Fix false negatives in
Rails/NotNullColumn
. (@pocke) - #3462: Don't create MultilineMethodCallBraceLayout offenses for single-line method calls when receiver spans multiple lines. (@maxjacobson)
- #3341: Exclude RSpec tests from inspection by
Style/NumericPredicate
cop. (@drenmi) - Rename
Lint/UselessArraySplat
toLint/UnneededSplatExpansion
, and add functionality to check for unnecessary expansion of other literals. (@rrosenblum) - No longer register an offense for splat expansion of an array literal in
Performance/CaseWhenSplat
.Lint/UnneededSplatExpansion
now handles this behavior. (@rrosenblum) Lint/InheritException
restricts inheriting from standard library subclasses ofException
. (@metcalf)- No longer register an offense if the first line of code starts with
#\
inStyle/LeadingCommentSpace
.config.ru
files consider such lines as options. (@scottohara) - #3292: Remove
Performance/PushSplat
as it can produce code that is slower or even cause failure. (@jonas054)
- #3306: Add autocorrection for
Style/EachWithObject
. (@owst) - Add new
Style/TernaryParentheses
cop. (@drenmi) - #3136: Add config for
UselessAccessModifier
so it can be made aware of ActiveSupport'sconcerning
andclass_methods
methods. (@maxjacobson) - #3128: Add new
Rails/SaveBang
cop. (@QuinnHarris) - Add new
Style/NumericPredicate
cop. (@drenmi)
- #3271: Fix bad auto-correct for
Style/EachForSimpleLoop
cop. (@drenmi) - #3288: Fix auto-correct of word and symbol arrays in
Style/ParallelAssignment
cop. (@jonas054) - #3307: Fix exception when inspecting an operator assignment with
Style/MethodCallParentheses
cop. (@drenmi) - #3316: Fix error for blocks without arguments in
Style/SingleLineBlockParams
cop. (@owst) - #3320: Make
Style/OpMethod
aware of the backtick method. (@drenmi) - Do not register an offense in
Lint/ShadowedException
when rescuing an exception built into Ruby before a custom exception. (@rrosenblum)
- #2645:
Style/EmptyLiteral
no longer generates an offense forString.new
when using frozen string literals. (@drenmi) - #3308: Make
Lint/NextWithoutAccumulator
aware of nested enumeration. (@drenmi) - Extend
Style/MethodMissing
cop to check for the conditions in the style guide. (@drenmi) - #3325: Drop support for MRI 1.9.3. (@drenmi)
- Add support for MRI 2.4. (@dvandersluis)
- #3256: Highlight the closing brace in
Style/Multiline...BraceLayout
cops. (@jonas054) - Always register an offense when rescuing
Exception
before or along with any other exception inLint/ShadowedException
. (@rrosenblum)
- #3248: Support 'ruby-' prefix in
.ruby-version
. (@tjwp) - #3250: Make regexp for cop names less restrictive in CommentConfig lines. (@tjwp)
- #3261: Prefer
TargetRubyVersion
to.ruby-version
. (@tjwp) - #3249: Account for
rescue nil
inStyle/ShadowedException
. (@rrosenblum) - Modify the highlighting in
Style/ShadowedException
to be more useful. Highlight justrescue
area. (@rrosenblum) - #3129: Fix
Style/MethodCallParentheses
to work with multiple assignments. (@tejasbubane) - #3247: Ensure whitespace after beginning of block in
Style/BlockDelimiters
. (@tjwp) - #2941: Make sure
Lint/UnneededDisable
can do auto-correction. (@jonas054) - #3269: Fix
Lint/ShadowedException
to block arbitrary code execution. (@pocke) - #3266: Handle empty parentheses in
Performance/RedundantBlockCall
auto-correct. (@jonas054) - #3272: Add escape character missing to LITERAL_REGEX. (@pocke)
- #3255: Fix auto-correct for
Style/RaiseArgs
when constructing exception without arguments. (@drenmi) - #3294: Allow to use
Time.zone_default
. (@Tei) - #3300: Do not replace
%q()
s containing escaped non-backslashes. (@owst)
- #3230: Improve highlighting for
Style/AsciiComments
cop. (@drenmi) - Improve highlighting for
Style/AsciiIdentifiers
cop. (@drenmi) - #3265: Include --no-offense-counts in .rubocop_todo.yml. (@vergenzt)
- #2956: Prefer
.ruby-version
toTargetRubyVersion
. (@pclalv) - #3095: Add
IndentationWidth
configuration parameter forStyle/AlignParameters
cop. (@alexdowad) - #3066: Add new
Style/ImplicitRuntimeError
cop which advises the use of an explicit exception class when raising an error. (@alexdowad) - #3018: Add new
Style/EachForSimpleLoop
cop which advises the use ofInteger#times
for simple loops which iterate a fixed number of times. (@alexdowad) - #2595: New
compact
style forStyle/SpaceInsideLiteralHashBraces
. (@alexdowad) - #2927: Add autocorrect for
Rails/Validation
cop. (@neodelf) - #3135: Add new
Rails/OutputSafety
cop. (@josh) - #3164: Add Fastlane's Fastfile to the default Includes. (@jules2689)
- #3173: Make
Style/ModuleFunction
configurable withmodule_function
andextend_self
styles. (@tjwp) - #3105: Add new
Rails/RequestReferer
cop. (@giannileggio) - #3200: Add autocorrect for
Style/EachForSimpleLoop
cop. (@tejasbubane) - #3058: Add new
Style/SpaceInsideArrayPercentLiteral
cop. (@owst) - #3058: Add new
Style/SpaceInsidePercentLiteralDelimiters
cop. (@owst) - #3179: Expose files to support testings Cops using RSpec. (@tjwp)
- #3191: Allow arbitrary comments after cop names in CommentConfig lines (e.g. rubocop:enable). (@owst)
- #3165: Add new
Lint/PercentStringArray
cop. (@owst) - #3165: Add new
Lint/PercentSymbolArray
cop. (@owst) - #3177: Add new
Style/NumericLiteralPrefix
cop. (@tejasbubane) - #1646: Add configuration style
indented_relative_to_receiver
forStyle/MultilineMethodCallIndentation
. (@jonas054) - New cop
Lint/ShadowedException
checks for the order which exceptions are rescued to avoid rescueing a less specific exception before a more specific exception. (@rrosenblum) - #3127: New cop
Lint/InheritException
checks for error classes inheriting fromException
, and instead suggestsRuntimeError
orStandardError
. (@drenmi) - Add new
Performance/PushSplat
cop. (@segiddins) - #3089: Add new
Rails/Exit
cop. (@sgringwe) - #3104: Add new
Style/MethodMissing
cop. (@haziqhafizuddin)
- #3005: Symlink protection prevents use of caching in CI context. (@urbanautomaton)
- #3037:
Style/StringLiterals
understands that a bare '#', not '#@variable' or '#{interpolation}', does not require double quotes. (@alexdowad) - #2722:
Style/ExtraSpacing
does not attempt to align an equals sign in an argument list with one in an assignment statement. (@alexdowad) - #3133:
Style/MultilineMethodCallBraceLayout
does not register offenses for single-line calls. (@alexdowad) - #3170:
Style/MutableConstant
does not infinite-loop when correcting an array with no brackets. (@alexdowad) - #3150: Fix auto-correct for Style/MultilineArrayBraceLayout. (@jspanjers)
- #3192: Fix
Lint/UnusedBlockArgument
'sIgnoreEmptyBlocks
parameter from being removed from configuration. (@jfelchner) - #3114: Fix alignment
end
when auto-correctingStyle/EmptyElse
. (@rrosenblum) - #3120: Fix
Lint/UselessAccessModifier
reporting useless access modifiers inside {Class,Module,Struct}.new blocks. (@owst) - #3125: Fix
Rails/UniqBeforePluck
to ignoreuniq
with block. (@tejasbubane) - #3116:
Style/SpaceAroundKeyword
allows&.
method calls aftersuper
andyield
. (@segiddins) - #3131: Fix
Style/ZeroLengthPredicate
to ignoresize
andlength
variables. (@tejasbubane) - #3146: Fix
NegatedIf
andNegatedWhile
to ignore double negations. (@natalzia-paperless) - #3140:
Style/FrozenStringLiteralComment
works with file doesn't have any tokens. (@pocke) - #3154: Fix handling of
()
inStyle/RedundantParentheses
. (@lumeet) - #3155: Fix
Style/SpaceAfterNot
reporting on thenot
keyword. (@NobodysNightmare) - #3160:
Style/Lambda
fix whitespacing when auto-correcting unparenthesized arguments. (@palkan) - #2944: Don't crash on strings that span multiple lines but only have one pair of delimiters in
Style/StringLiterals
. (@jonas054) - #3157: Don't let
LineEndConcatenation
andUnneededInterpolation
make changes to the same string during auto-correct. (@jonas054) - #3187: Let
Style/BlockDelimiters
ignore blocks in all method arguments. (@jonas054) - Modify
Style/ParallelAssignment
to use implicit begins when parallel assignment uses arescue
modifier and is the only thing in the method. (@rrosenblum) - #3217: Fix output of ellipses for multi-line offense ranges in HTML formatter. (@jonas054)
- #3207: Auto-correct modifier
while
/until
andbegin
..end
+while
/until
inStyle/InfiniteLoop
. (@jonas054) - #3202: Fix
Style/EmptyElse
registering wrong offenses and thus making RuboCop crash. (@deivid-rodriguez) - #3183: Ensure
Style/SpaceInsideBlockBraces
reports offenses for multi-line blocks. (@owst) - #3017: Fix
Style/StringLiterals
to register offenses on non-ascii strings. (@deivid-rodriguez) - #3056: Fix
Style/StringLiterals
to register offenses on non-ascii strings. (@deivid-rodriguez) - #2986: Fix
RedundantBlockCall
to not report calls that pass block arguments, or where the block has been overridden. (@owst) - #3223: Return can take many arguments. (@ptarjan)
- #3239: Fix bug with --auto-gen-config and a file that does not exist. (@meganemura)
- #3138: Fix RuboCop crashing when config file contains utf-8 characters and external encoding is not utf-8. (@deivid-rodriguez)
- #3175: Generate 'Exclude' list for the cops with configurable enforced style to
.rubocop_todo.yml
if different styles are used. (@flexoid) - #3231: Make
Rails/UniqBeforePluck
more conservative. (@tjwp)
- #3149: Make
Style/HashSyntax
configurable to not report hash rocket syntax for symbols ending with ? or ! when using ruby19 style. (@owst) - #1758: Let
Style/ClosingParenthesisIndentation
followStyle/AlignParameters
configuration for method calls. (@jonas054) - #3224: Rename
Style/DeprecatedHashMethods
toStyle/PreferredHashMethods
. (@tejasbubane)
- #2997:
Performance/CaseWhenSplat
can now identify multiple offenses in the same branch and offenses that do not occur as the first argument. (@rrosenblum) - #2928:
Style/NestedParenthesizedCalls
cop can auto-correct. (@drenmi) Style/RaiseArgs
cop can auto-correct. (@drenmi)- #2993:
Style/SpaceAfterColon
now checks optional keyword arguments. (@owst) - #3003: Read command line options from
.rubocop
file andRUBOCOP_OPTS
environment variable. (@bolshakov) - #2857:
Style/MultilineArrayBraceLayout
enforced style is configurable and supportssymmetrical
andnew_line
options. (@panthomakos) - #2857:
Style/MultilineHashBraceLayout
enforced style is configurable and supportssymmetrical
andnew_line
options. (@panthomakos) - #2857:
Style/MultilineMethodCallBraceLayout
enforced style is configurable and supportssymmetrical
andnew_line
options. (@panthomakos) - #2857:
Style/MultilineMethodDefinitionBraceLayout
enforced style is configurable and supportssymmetrical
andnew_line
options. (@panthomakos) - #3052:
Style/MultilineArrayBraceLayout
enforced style supportssame_line
option. (@panthomakos) - #3052:
Style/MultilineHashBraceLayout
enforced style supportssame_line
option. (@panthomakos) - #3052:
Style/MultilineMethodCallBraceLayout
enforced style supportssame_line
option. (@panthomakos) - #3052:
Style/MultilineMethodDefinitionBraceLayout
enforced style supportssame_line
option. (@panthomakos) - #3019: Add new
Style/EmptyCaseCondition
cop. (@owst, @rrosenblum) - #3072: Add new
Lint/UselessArraySplat
cop. (@owst) - #3022:
Style/Lambda
enforced style supportsliteral
option. (@drenmi) - #2909:
Style/Lambda
enforced style supportslambda
option. (@drenmi) - #3092: Allow
Style/Encoding
to enforce using no encoding comments. (@NobodysNightmare) - New cop
Rails/UniqBeforePluck
checks thatuniq
is used beforepluck
. (@tjwp)
- #3112: Fix
Style/ClassAndModuleChildren
for nested classes with explicit superclass. (@jspanjers) - #3032: Fix autocorrecting parentheses for predicate methods without space before args. (@graemeboy)
- #3000: Fix encoding crash on HTML output. (@gerrywastaken)
- #2983:
Style/AlignParameters
message was clarified forwith_fixed_indentation
style. (@dylanahsmith) - #2314: Ignore
UnusedBlockArgument
for keyword arguments. (@volkert) - #2975: Make comment indentation before
)
consistent with comment indentation before}
or]
. (@jonas054) - #3010: Fix double reporting/correction of spaces after ternary operator colons (now only reported by
Style/SpaceAroundOperators
, and notStyle/SpaceAfterColon
too). (@owst) - #3006: Register an offense for calling
merge!
on a method on a variable insideeach_with_object
inPerformance/RedundantMerge
. (@lumeet, @rrosenblum) - #2886: Custom cop changes now bust the cache. (@ptarjan)
- #3043:
Style/SpaceAfterNot
will now register an offense for a receiver that is wrapped in parentheses. (@rrosenblum) - #3039: Accept
match
without a receiver inPerformance/EndWith
. (@lumeet) - #3039: Accept
match
without a receiver inPerformance/StartWith
. (@lumeet) - #3048:
Lint/NestedMethodDefinition
shouldn't flag methods defined on Structs. (@owst) - #2912: Check whether a line is aligned with the following line if the preceding line is not an assignment. (@akihiro17)
- #3036: Don't let
Lint/UnneededDisable
inspect files that are excluded for the cop. (@jonas054) - #2874: Fix bug when the closing parenthesis is preceded by a newline in array and hash literals in
Style/RedundantParentheses
. (@lumeet) - #3049: Make
Lint/UselessAccessModifier
detect conditionally defined methods and correctly handle dynamically defined methods and singleton class methods. (@owst) - #3004: Don't add
Style/Alias
offenses for use ofalias
ininstance_eval
blocks, since object instances don't respond toalias_method
. (@magni-) - #3061: Custom cops now show up in --show-cops. (@ptarjan)
- #3088: Ignore offenses that involve conflicting HEREDOCs in the
Style/Multiline*BraceLayout
cops. (@panthomakos) - #3083: Do not register an offense for splat block args in
Style/SymbolProc
. (@rrosenblum) - #3063: Don't auto-correct
a + \
intoa + \\
inStyle/LineEndConcatenation
. (@jonas054) - #3034: Report offenses for
RuntimeError.new(msg)
inStyle/RedundantException
. (@jonas054) - #3016:
Style/SpaceAfterComma
now usesStyle/SpaceInsideHashLiteralBraces
's setting. (@ptarjan)
- #2995: Removed deprecated path matching syntax. (@gerrywastaken)
- #3025: Removed deprecation warnings for
rubocop-todo.yml
. (@ptarjan) - #3028: Add
define_method
to the default list ofIgnoredMethods
ofStyle/SymbolProc
. (@jastkand) - #3064:
Style/SpaceAfterNot
highlights the entire expression instead of just the exlamation mark. (@rrosenblum) - #3085: Enable
Style/MultilineArrayBraceLayout
andStyle/MultilineHashBraceLayout
with thesymmetrical
style by default. (@panthomakos) - #3091: Enable
Style/MultilineMethodCallBraceLayout
andStyle/MultilineMethodDefinitionBraceLayout
with thesymmetrical
style by default. (@panthomakos) - #1830:
Style/PredicateName
now ignores thespec/
directory, since there is a strong convention for usinghave_*
andbe_*
helper methods in RSpec. (@gylaz)
Performance/TimesMap
cop can auto-correct. (@lumeet)Style/ZeroLengthPredicate
cop can auto-correct. (@lumeet)- #2828:
Style/ConditionalAssignment
is now configurable to enforce assignment inside of conditions or to enforce assignment to conditions. (@rrosenblum) - #2862:
Performance/Detect
andPerformance/Count
have a new configurationSafeMode
that is defaulted totrue
. These cops have known issues withRails
and other ORM frameworks. With this default configuration, these cops will not run if theRails
cops are enabled. (@rrosenblum) Style/IfUnlessModifierOfIfUnless
cop added. (@amuino)
- #2948:
Style/SpaceAroundKeyword
should allowyield[n]
andsuper[n]
. (@laurelfan) - #2950: Fix auto-correcting cases in which precedence has changed in
Style/OneLineConditional
. (@lumeet) - #2947: Fix auto-correcting
if-then
inStyle/Next
. (@lumeet) - #2904:
Style/RedundantParentheses
doesn't flag-(1.method)
or+(1.method)
, since removing the parentheses would change the meaning of these expressions. (@alexdowad) - #2958:
Style/MultilineMethodCallIndentation
doesn't fail when inspecting unary ops which span multiple lines. (@alexdowad) - #2959:
Lint/LiteralInInterpolation
doesn't report offenses for iranges and eranges with non-literal endpoints. (@alexdowad) - #2960:
Lint/AssignmentInCondition
catches method assignments (likeobj.attr = val
) in a condition. (@alexdowad) - #2871: Second solution for possible encoding incompatibility when outputting an HTML report. (@jonas054)
- #2967: Fix auto-correcting of
===
,<=
, and>=
inStyle/ConditionalAssignment
. (@rrosenblum) - #2977: Fix auto-correcting of
"#{$!}"
inStyle/SpecialGlobalVars
. (@lumeet) - #2935: Make configuration loading work if
SafeYAML.load
is private. (@jonas054)
require:
only does relative includes when it starts with a.
. (@ptarjan)Style/IfUnlessModifier
does not trigger if the body is another conditional. (@amuino)- #2963:
Performance/RedundantMerge
will now register an offense inside ofeach_with_object
. (@rrosenblum)
Style/UnlessElse
cop can auto-correct. (@lumeet)- #2629: Add a new public API method,
highlighted_area
to offense. This method returns the range of the highlighted portion of an offense. (@rrosenblum) Style/OneLineConditional
cop can auto-correct. (@lumeet)- #2905:
Style/ZeroLengthPredicate
flags code likearray.length < 1
,1 > array.length
, and so on. (@alexdowad) - #2892:
Lint/BlockAlignment
cop can be configured to be stricter. (@ptarjan) Style/Not
is able to autocorrect in cases where parentheses must be added to preserve the meaning of an expression. (@alexdowad)Style/Not
auto-corrects comparison expressions by removingnot
and using the opposite comparison. (@alexdowad)
- Add
require 'time'
toremote_config.rb
to avoid "undefined method `rfc2822'". (@necojackarc) - Replace
Rake::TaskManager#last_comment
withRake::TaskManager#last_description
for Rake 11 compatibility. (@tbrisker) - Fix false positive in
Style/TrailingCommaInArguments
&Style/TrailingCommaInLiteral
cops with consistent_comma style. (@meganemura) - #2861: Fix false positive in
Style/SpaceAroundKeyword
forrescue(...
. (@rrosenblum) - #2832:
Style/MultilineOperationIndentation
treats operations inside blocks inside other operations correctly. (@jonas054) - #2865: Change
require:
in config to be relative to the.rubocop.yml
file itself. (@ptarjan) - #2845: Handle heredocs in
Style/MultilineLiteralBraceLayout
auto-correct. (@jonas054) - #2848: Handle comments inside arrays in
Style/MultilineArrayBraceLayout
auto-correct. (@jonas054) Style/TrivialAccessors
allows predicate methods by default. (@alexdowad)- #2869: Offenses which occur in the body of a
when
clause with multiple arguments will not be missed. (@alexdowad) Lint/UselessAccessModifier
recognizes method defs inside abegin
block. (@alexdowad)- #2870:
Lint/UselessAccessModifier
recognizes method definitions which are passed as an argument to a method call. (@alexdowad) - #2859:
Style/RedundantParentheses
doesn't consider the parentheses in(!receiver.method arg)
to be redundant, since they might change the meaning of an expression, depending on precedence. (@alexdowad) - #2852:
Performance/Casecmp
doesn't flag uses ofdowncase
/upcase
which are not redundant. (@alexdowad) - #2850:
Style/FileName
doesn't choke on empty files with spaces in their names. (@alexdowad) - #2834: When configured as
ConsistentQuotesInMultiline: true
,Style/StringLiterals
doesn't error out when inspecting a heredoc with differing indentation across multiple lines. (@alexdowad) - #2876:
Style/ConditionalAssignment
behaves correctly when assignment statement uses a character which has a special meaning in a regex. (@alexdowad) - #2877:
Style/SpaceAroundKeyword
doesn't flag!super.method
,!yield.method
, and so on. (@alexdowad) - #2631:
Style/Encoding
can remove unneeded encoding comment when autocorrecting withwhen_needed
style. (@alexdowad) - #2860: Fix false positive in
Rails/Date
whento_time
is chained with safe method. (@palkan) - #2898:
Lint/NestedMethodDefinition
allows methods defined insideClass.new(S)
blocks. (@segiddins) - #2894: Fix auto-correct an unless with a comparison operator. (@jweir)
- #2911:
Style/ClassAndModuleChildren
doesn't flag nested class definitions, where the outer class has an explicit superclass (because such definitions can't be converted tocompact
style). (@alexdowad) - #2871: Don't crash when offense messages are read back from cache with
ASCII-8BIT
encoding and output as HTML or JSON. (@jonas054) - #2901: Don't crash when
ENV['HOME']
is undefined. (@mikegee) - #2627:
Style/BlockDelimiters
does not flag blocks delimited by{}
when a block call is the final value in a hash with implicit braces (one which is the last argument to an outer method call). (@alexdowad)
- Update Rake to version 11. (@tbrisker)
- #2629: Change the offense range for metrics cops to default to
expression
instead ofkeyword
(the offense now spans the entire method, class, or module). (@rrosenblum) - #2891: Change the caching of remote configs to live alongside the parent file. (@Fryguy)
- #2662: When setting options for Rake task, nested arrays can be used in the
options
,formatters
, andrequires
arrays. (@alexdowad) - #2925: Bump unicode-display_width dependency to >= 1.0.1. (@jspanjers)
- #2875:
Style/SignalException
does not flag calls tofail
if a custom method namedfail
is defined in the same file. (@alexdowad) - #2923:
Style/FileName
considers file names which contain a ? or ! character to still be "snake case". (@alexdowad) - #2879: When autocorrecting,
Lint/UnusedMethodArgument
removes unused block arguments rather than simply prefixing them with an underscore. (@alexdowad)
- Fix auto-correction of array and hash literals in
Lint/LiteralInInterpolation
. (@lumeet) - #2815: Fix missing assets for html formatter. (@prsimp)
Style/RedundantParentheses
catches offenses involving the 2nd argument to a method call without parentheses, if the 2nd argument is a hash. (@alexdowad)Style/RedundantParentheses
catches offenses inside an array literal. (@alexdowad)Style/RedundantParentheses
doesn't flagmethod (:arg) {}
, since removing the parentheses would change the meaning of the expression. (@alexdowad)Performance/Detect
doesn't flag code wherefirst
orlast
takes an argument, as it cannot be transformed to equivalent code usingdetect
. (@alexdowad)Style/SpaceAroundOperators
ignores aref assignments. (@alexdowad)Style/RescueModifier
indents code correctly when auto-correcting. (@alexdowad)Style/RedundantMerge
indents code correctly when auto-correcting, even if the corrected hash had multiple keys, and even if the corrected code was indented to start with. (@alexdowad)- #2831:
Performance/RedundantMerge
doesn't break code by autocorrecting a#merge!
call which occurs at tail position in a block. (@alexdowad)
- Handle auto-correction of nested interpolations in
Lint/LiteralInInterpolation
. (@lumeet) - RuboCop results cache uses different directory names when there are many (or long) CLI options, to avoid a very long path which could cause failures on some filesystems. (@alexdowad)
- #2798:
Rails/FindEach
cop works withwhere.not
. (@pocke) Style/MultilineBlockLayout
can correct offenses which involve argument destructuring. (@alexdowad)Style/SpaceAroundKeyword
checkssuper
nodes with no args. (@alexdowad)Style/SpaceAroundKeyword
checksdefined?
nodes. (@alexdowad)- #2719:
Style/ConditionalAssignment
handles correcting the alignment ofend
. (@rrosenblum)
- Fix auto-correction of
not
with parentheses inStyle/Not
. (@lumeet) - #2784: RuboCop can inspect
super { ... }
andsuper(arg) { ... }
. (@alexdowad) - #2781:
Performance/RedundantMerge
doesn't flag calls to#update
, since many classes have methods by this name (not onlyHash
). (@alexdowad) - #2780:
Lint/DuplicateMethods
does not flag method definitions inside dynamicClass.new
blocks. (@alexdowad) - #2775:
Style/SpaceAroundKeyword
doesn't flagyield.method
. (@alexdowad) - #2774:
Style/SpaceAroundOperators
doesn't flag calls to#[]
. (@alexdowad) - #2772: RuboCop doesn't crash when
AllCops
section in configuration file is empty (rather, it displays a warning as intended). (@alexdowad) - #2737:
Style/GuardClause
handleselsif
clauses correctly. (@alexdowad) - #2735:
Style/MultilineBlockLayout
doesn't cause an infinite loop by movingend
onto the same line as the block args. (@alexdowad) - #2715:
Performance/RedundantMatch
doesn't flag calls to#match
which take a block. (@alexdowad) - #2704:
Lint/NestedMethodDefinition
doesn't flag singleton defs which define a method on the value of a local variable. (@alexdowad) - #2660:
Style/TrailingUnderscoreVariable
shows recommended code in its offense message. (@alexdowad) - #2671:
Style/WordArray
doesn't attempt to inspect strings with invalid encoding, to avoid failing with an encoding error. (@alexdowad)
- #2739: Change the configuration option
when_needed
inStyle/FrozenStringLiteralComment
to add afrozen_string_literal
comment to all files when theTargetRubyVersion
is set to 2.3+. (@rrosenblum)
- #2620: New cop
Style/ZeroLengthPredicate
checks forobject.size == 0
and variants, and suggests replacing them with an appropriateempty?
predicate. (@drenmi) - #2657: Floating headers in HTML output. (@mattparlane)
- Add new
Style/SpaceAroundKeyword
cop. (@lumeet) - #2745: New cop
Style/MultilineHashBraceLayout
checks that the closing brace in a hash literal is symmetrical with respect to the opening brace and the hash elements. (@panthomakos) - #2761: New cop
Style/MultilineMethodDefinitionBraceLayout
checks that the closing brace in a method definition is symmetrical with respect to the opening brace and the method parameters. (@panthomakos) - #2699:
Performance/Casecmp
can register offenses whenstr.downcase
orstr.upcase
are passed to an equality method. (@rrosenblum) - #2766: New cop
Style/MultilineMethodCallBraceLayout
checks that the closing brace in a method call is symmetrical with respect to the opening brace and the method arguments. (@panthomakos) Style/Semicolon
can autocorrect useless semicolons at the beginning of a line. (@alexdowad)
- #2723: Fix NoMethodError in Style/GuardClause. (@drenmi)
- #2674: Also check for Hash#update alias in
Performance/RedundantMerge
. (@drenmi) - #2630: Take frozen string literals into account in
Style/MutableConstant
. (@segiddins) - #2642: Support assignment via
||=
inStyle/MutableConstant
. (@segiddins) - #2646: Fix auto-correcting assignment to a constant in
Style/ConditionalAssignment
. (@segiddins) - #2614: Check for zero return value from
casecmp
inPerformance/casecmp
. (@segiddins) - #2647: Allow
xstr
interpolations inLint/LiteralInInterpolation
. (@segiddins) - Report a violation when
freeze
is called on a frozen string literal inStyle/RedundantFreeze
. (@segiddins) - #2641: Fix crashing on empty methods with block args in
Perfomance/RedundantBlockCall
. (@segiddins) Lint/DuplicateMethods
doesn't crash whenclass_eval
is used with an implicit receiver. (@lumeet)- #2654: Fix handling of unary operations in
Style/RedundantParentheses
. (@lumeet) - #2661:
Style/Next
doesn't crash when auto-correcting modifierif/unless
. (@lumeet) - #2665: Make specs pass when running on Windows. (@jonas054)
- #2691: Do not register an offense in
Performance/TimesMap
for callingmap
orcollect
on a variable namedtimes
. (@rrosenblum) - #2689: Change
Performance/RedundantBlockCall
to respect parentheses usage. (@rrosenblum) - #2694: Fix caching when using a different JSON gem such as Oj. (@georgyangelov)
- #2707: Change
Lint/NestedMethodDefinition
to respectClass.new
andModule.new
. (@owst) - #2701: Do not consider assignments to the same variable as useless if later assignments are within a loop. (@owst)
- #2696:
Style/NestedModifier
adds parentheses around a condition when needed. (@lumeet) - #2666: Fix bug when auto-correcting symbol literals in
Lint/LiteralInInterpolation
. (@lumeet) - #2664:
Performance/Casecmp
can auto-correct case comparison to variables and method calls without error. (@rrosenblum) - #2729: Fix handling of hash literal as the first argument in
Style/RedundantParentheses
. (@lumeet) - #2703: Handle byte order mark in
Style/IndentationWidth
,Style/ElseAlignment
,Lint/EndAlignment
, andLint/DefEndAlignment
. (@jonas054) - #2710: Fix handling of fullwidth characters in some cops. (@seikichi)
- #2690: Fix alignment of operands that are part of an assignment in
Style/MultilineOperationIndentation
. (@jonas054) - #2228: Use the config of a related cop whether it's enabled or not. (@madwort)
- #2721: Do not register an offense for constants wrapped in parentheses passed to
rescue
inStyle/RedundantParentheses
. (@rrosenblum) - #2742: Fix
Style/TrailingCommaInArguments
&Style/TrailingCommaInLiteral
for inline single element arrays. (@annih) - #2768: Allow parentheses after keyword
not
inStyle/MethodCallParentheses
. (@lumeet) - #2758: Allow leading underscores in camel case variable names.(@mmcguinn)
- Remove
Style/SpaceAfterControlKeyword
andStyle/SpaceBeforeModifierKeyword
as the more genericStyle/SpaceAroundKeyword
handles the same cases. (@lumeet) - Handle comparisons with
!=
inPerformance/casecmp
. (@segiddins) - #2684: Do not base
Style/FrozenStringLiteralComment
on the version of Ruby that is running. (@rrosenblum) - #2732: Change the default style of
Style/SignalException
toonly_raise
. (@bbatsov)
- #2598: New cop
Lint/RandOne
checks forrand(1)
,Kernel.rand(1.0)
and similar calls. Such call are most likely a mistake because they always return0
. (@DNNX) - #2590: New cop
Performance/DoubleStartEndWith
checks for twostart_with?
(orend_with?
) calls joined by||
with the same receiver, likestr.start_with?('x') || str.start_with?('y')
and suggests using one call instead:str.start_with?('x', 'y')
. (@DNNX) - #2583: New cop
Performance/TimesMap
checks forx.times.map{}
and suggests replacing them withArray.new(x){}
. (@DNNX) - #2581: New cop
Lint/NextWithoutAccumulator
finds barenext
inreduce
/inject
blocks which assignsnil
to the accumulator. (@mvidner) - #2529: Add EnforcedStyle config parameter to IndentArray. (@jawshooah)
- #2479: Add option
AllowHeredoc
toMetrics/LineLength
. (@fphilipe) - #2416: New cop
Style/ConditionalAssignment
checks for assignment of the same variable in all branches of conditionals and replaces them with a single assignment to the return of the conditional. (@rrosenblum) - #2410: New cop
Style/IndentAssignment
checks the indentation of the first line of the right-hand-side of a multi-line assignment. (@panthomakos) - #2431: Add
IgnoreExecutableScripts
option toStyle/FileName
. (@sometimesfood) - #2460: New cop
Style/UnneededInterpolation
checks for strings that are just an interpolated expression. (@cgriego) - #2361:
Style/MultilineAssignmentLayout
cop checks for a newline after the assignment operator in a multi-line assignment. (@panthomakos) - #2462:
Lint/UselessAccessModifier
can catch more types of useless access modifiers. (@alexdowad) - #1677: Add new
Performance/Casecmp
cop. (@alexdowad) - #1677: Add new
Performance/RangeInclude
cop. (@alexdowad) - #1677: Add new
Performance/RedundantSortBy
cop. (@alexdowad) - #1677: Add new
Performance/LstripRstrip
cop. (@alexdowad) - #1677: Add new
Performance/StartWith
cop. (@alexdowad) - #1677: Add new
Performance/EndWith
cop. (@alexdowad) - #1677: Add new
Performance/RedundantMerge
cop. (@alexdowad) Lint/Debugger
cop can now auto-correct offenses. (@alexdowad)- #1677: Add new
Performance/RedundantMatch
cop. (@alexdowad) - #1677: Add new
Performance/RedundantBlockCall
cop. (@alexdowad) - #1954:
Lint/UnneededDisable
can now autocorrect. (@alexdowad) - #2501: Add new
Lint/ImplicitStringConcatenation
cop. (@alexdowad) - Add new
Style/RedundantParentheses
cop. (@lumeet) - #1346:
Style/SpecialGlobalVars
can be configured to use eitheruse_english_names
oruse_perl_names
styles. (@alexdowad) - #2426: New
Style/NestedParenthesizedCalls
cop checks for non-parenthesized method calls nested inside a parenthesized call, likemethod1(method2 arg)
. (@alexdowad) - #2502: The
--stdin
and--auto-correct
CLI options can be combined, and if you do so, corrected code is printed to stdout. (@alexdowad) Style/ConditionalAssignment
works on conditionals with a common aref assignment (likearray[index] = val
) or attribute assignment (likeself.attribute = val
). (@alexdowad)- #2476:
Style/GuardClause
catches if..else nodes with one branch which terminates the execution of the current scope. (@alexdowad) - New
Style/IdenticalConditionalBranches
flagsif..else
andcase..when..else
constructs with an identical line at the end of each branch. (@alexdowad) - #207: Add new
Lint/FloatOutOfRange
cop which catches floating-point literals which are too large or too small for Ruby to represent. (@alexdowad) Style/GuardClause
doesn't report offenses in places where correction would make a line too long. (@alexdowad)Lint/DuplicateMethods
can find duplicate method definitions in many more circumstances, even across multiple files; however, it ignores definitions insideif
or something which could be a DSL method. (@alexdowad)- A warning is printed if an invalid
EnforcedStyle
is configured. (@alexdowad) - #1367: New
Lint/IneffectiveAccessModifier
checks for access modifiers which are erroneously applied to a singleton method, where they have no effect. (@alexdowad) - #1614:
Lint/BlockAlignment
aligns block end with splat operator when applied to a splatted method call. (@alexdowad) - #2263: Warn if
task.options = %w(--format ...)
is used when configuringRuboCop::RakeTask
; this should betask.formatters = ...
instead. (@alexdowad) - #2511:
--no-offense-counts
CLI option suppresses the inclusion of offense count lines in auto-generated config. (@alexdowad) - #2504: New
AllowForAlignment
config parameter forStyle/SingleSpaceBeforeFirstArg
allows the insertion of extra spaces before the first argument if it aligns it with something on the preceding or following line. (@alexdowad) - #2478:
Style/ExtraSpacing
has newForceEqualSignAlignment
config parameter which forces = signs on consecutive lines to be aligned, and it can auto-correct. (@alexdowad) Lint/BlockAlignment
aligns block end with unary operators like ~, -, or ! when such operators are applied to the method call taking the block. (@alexdowad)- #1460:
Style/Alias
supports bothprefer_alias
andprefer_alias_method
styles. (@alexdowad) - #1569: New
ExpectMatchingDefinition
config parameter forStyle/FileName
makes it check for a class or module definition in each file which corresponds to the file name and path. (@alexdowad) - #2480: Add a configuration to
Style/ConditionalAssignment
to check and correct conditionals that contain multiple assignments. (@rrosenblum) - #2480: Allow
Style/ConditionalAssignment
to correct assignment in ternary operations. (@rrosenblum) - #2480: Allow
Style/ConditionalAssignment
to correct comparable methods. (@rrosenblum) - #1633: New cop
Style/MultilineMethodCallIndentation
takes over the responsibility for checking alignment of methods from theStyle/MultilineOperationIndentation
cop. (@jonas054) - #2472: New cop
Style/MultilineArrayBraceLayout
checks that the closing brace in an array literal is symmetrical with respect to the opening brace and the array elements. (@panthomakos) - #1543:
Style/WordArray
has bothpercent
andbrackets
(which enforces the use of bracketed arrays for strings) styles. (@alexdowad) Style/SpaceAroundOperators
hasAllowForAlignment
config parameter which allows extra spaces on the left if they serve to align the operator with another. (@alexdowad)Style/SymbolArray
has bothpercent
andbrackets
(which enforces the user of bracketed arrays for symbols) styles. (@alexdowad)- #2343: Entire cop types (or "departments") can be disabled using in .rubocop.yml using config like
Style: Enabled: false
. (@alexdowad) - #2399: New
start_of_line
style forLint/EndAlignment
aligns a closingend
keyword with the start of the line where the opening keyword appears. (@alexdowad) - #1545: New
Regex
config parameter forStyle/FileName
allows user to provide their own regex for validating file names. (@alexdowad) - #2253: New
DefaultFormatter
config parameter can be used to set formatter from within .rubocop.yml. (@alexdowad) - #2481: New
WorstOffendersFormatter
prints a list of files with offenses (and offense counts), showing the files with the most offenses first. (@alexdowad) - New
IfInsideElse
cop catchesif..end
nodes which can be converted into anelsif
instead, reducing the nesting level. (@alexdowad) - #1725: --color CLI option forces color output, even when not printing to a TTY. (@alexdowad)
- #2549: New
ConsistentQuotesInMultiline
config param forStyle/StringLiterals
forces all literals which are concatenated using \ to use the same quote style. (@alexdowad) - #2560:
Style/AccessModifierIndentation
,Style/CaseIndentation
,Style/FirstParameterIndentation
,Style/IndentArray
,Style/IndentAssignment
,Style/IndentHash
,Style/MultilineMethodCallIndentation
, andStyle/MultilineOperationIndentation
all have a newIndentationWidth
parameter which can be used to override the indentation width fromStyle/IndentationWidth
. (@alexdowad) - Add new
Performance/HashEachMethods
cop. (@ojab) - New cop
Style/FrozenStringLiteralComment
will check for and add the comment# frozen_string_literal: true
to the top of files. This will help with upgrading to Ruby 3.0. (@rrosenblum)
- #2594:
Style/EmptyLiteral
autocorrector respectsStyle/StringLiterals:EnforcedStyle
config. (@DNNX) - #2411: Make local inherited configuration override configuration loaded from gems. (@jonas054)
- #2413: Allow
%Q
for dynamic strings with double quotes inside them. (@jonas054) - #2404:
Style/Next
does not remove comments when auto-correcting. (@lumeet) Style/Next
handles auto-correction of nested offenses. (@lumeet)Style/VariableInterpolation
now detects non-numeric regex back references. (@cgriego)ProgressFormatter
fully respects the--no-color
switch. (@savef)- Replace
Time.zone.current
withTime.current
onRails::TimeZone
cop message. (@volmer) - #2451:
Style/StabbyLambdaParentheses
does not treat method calls namedlambda
as lambdas. (@domcleal) - #2463: Allow comments before an access modifier. (@codebeige)
- #2471:
Style/MethodName
doesn't choke on methods which are defined inside methods. (@alexdowad) - #2449:
Style/StabbyLambdaParentheses
only checks lambdas in the arrow form. (@lumeet) - #2456:
Lint/NestedMethodDefinition
doesn't register offenses for method definitions inside an eval block (eitherinstance_eval
,class_eval
, ormodule_eval
). (@alexdowad) - #2464:
Style/ParallelAssignment
understands aref and attribute assignments, and doesn't warn if they can't be correctly rearranged into a series of single assignments. (@alexdowad) - #2482:
Style/AndOr
doesn't raise an exception when trying to autocorrect!variable or ...
. (@alexdowad) - #2446:
Style/Tab
doesn't register errors for leading tabs which occur inside a string literal (including heredoc). (@alexdowad) - #2452:
Style/TrailingComma
incorrectly categorizes single-line hashes in methods calls. (@panthomakos) - #2441:
Style/AlignParameters
doesn't crash if it finds nested offenses. (@alexdowad) - #2436:
Style/SpaceInsideHashLiteralBraces
doesn't mangle a hash literal which is not surrounded by curly braces, but has another hash literal which does as its first key. (@alexdowad) - #2483:
Style/Attr
differentiate between attr_accessor and attr_reader. (@weh) Style/ConditionalAssignment
doesn't crash if it finds acase
with an empty branch. (@lumeet)- #2506:
Lint/FormatParameterMismatch
understands%{}
and%<>
interpolations. (@alexdowad) - #2145:
Lint/ParenthesesAsGroupedExpression
ignores calls with multiple arguments, since they are not ambiguous. (@alexdowad) - #2484: Remove two vulnerabilities in cache handling. (@jonas054)
- #2517:
Lint/UselessAccessModifier
doesn't think that an access modifier applied toattr_writer
is useless. (@alexdowad) - #2518:
Style/ConditionalAssignment
doesn't think that branches using<<
and[]=
should be combined. (@alexdowad) CharacterLiteral
auto-corrector now properly corrects?'
. (@bfontaine)- #2313:
Rails/FindEach
doesn't break code which usesorder(...).each
,limit(...).each
, and so on. (@alexdowad) - #1938:
Rails/FindBy
doesn't autocorrectwhere(...).first
tofind_by
, since the returned record is often different. (@alexdowad) - #1801:
EmacsFormatter
strips newlines out of error messages, if there are any. (@alexdowad) - #2534:
Style/RescueEnsureAlignment
works onrescue
nested inside aclass
ormodule
block. (@alexdowad) Lint/BlockAlignment
does not refer to a block terminator asend
when it is actually}
. (@alexdowad)- #2540:
Lint/FormatParameterMismatch
understands format specifiers with multiple flags. (@alexdowad) - #2538:
Style/SpaceAroundOperators
doesn't eat newlines. (@alexdowad) - #2531:
Style/AndOr
autocorrects in cases where parentheses must be added, even inside a nested begin node. (@alexdowad) - #2450:
Style/Next
adjusts indentation when auto-correcting, to avoid introducing new offenses. (@alexdowad) - #2066:
Style/TrivialAccessors
doesn't flag what appear to be trivial accessor method definitions, if they are nested inside a call toinstance_eval
. (@alexdowad) Style/SymbolArray
doesn't flag arrays of symbols if a symbol contains a space character. (@alexdowad)Style/SymbolArray
can auto-correct offenses. (@alexdowad)- #2546: Report when two
rubocop:disable
comments (not the single line kind) for a given cop apppear in a file with norubocop:enable
in between. (@jonas054) - #2552:
Style/Encoding
can auto-correct files with a blank first line. (@alexdowad) - #2556:
Style/SpecialGlobalVariables
generates auto-config correctly. (@alexdowad) - #2565: Let
Style/SpaceAroundOperators
leave spacing around=>
toStyle/AlignHash
. (@jonas054) - #2569:
Style/MethodCallParentheses
doesn't register warnings forobject.()
syntax, since it is handled byStyle/LambdaCall
. (@alexdowad) - #2570:
Performance/RedundantMerge
doesn't break code with a modifierif
when autocorrecting. (@alexdowad) Performance/RedundantMerge
doesn't break code with a modifierwhile
oruntil
when autocorrecting. (@alexdowad)- #2574:
variable
style forLint/EndAlignment
is working again. (@alexdowad) Lint/EndAlignment
can autocorrect offenses on the RHS of an assignment to an instance variable, class variable, constant, and so on; previously, it only worked if the LHS was a local variable. (@alexdowad)- #2580:
Style/StringReplacement
doesn't break code when autocorrection involves a regex with embedded escapes (like /\n/). (@alexdowad) - #2582:
Style/AlignHash
doesn't move a key so far left that it goes onto the previous line (in an attempt to align). (@alexdowad) - #2588:
Style/SymbolProc
doesn't break code when autocorrecting a method call with a trailing comma in the argument list. (@alexdowad) - #2448:
Style/TrailingCommaInArguments
andStyle/TrailingCommaInLiteral
don't special-case single-item lists in a way which contradicts the documentation. (@alexdowad) - Fix for remote config files to only load from on http and https URLs. (@ptrippett)
- #2604:
Style/FileName
doesn't fail on empty files whenExpectMatchingDefinition
is true. (@alexdowad) Style/RedundantFreeze
registers offences for frozen dynamic symbols. (@segiddins)- #2609: All cops which rely on the
AutocorrectUnlessChangingAST
module can now autocorrect files which contain__FILE__
. (@alexdowad) - #2608:
Style/ConditionalAssignment
can autocorrect=~
within a ternary expression. (@alexdowad)
- #2427: Allow non-snake-case file names (e.g.
some-random-script
) for Ruby scripts that have a shebang. (@sometimesfood) - #2430:
Lint/UnneededDisable
now adds "unknown cop" to messages if cop names inrubocop:disable
comments are unrecognized, or "did you mean ..." if they are misspelled names of existing cops. (@jonas054) - #947:
Style/Documentation
considers classes and modules which only define constants to be "namespaces", and doesn't flag them for lack of a documentation comment. (@alexdowad) - #2467: Explicitly inheriting configuration from the rubocop gem in .rubocop.yml is not allowed. (@alexdowad)
- #2322: Output of --auto-gen-config shows content of default config parameters which are Arrays; this is especially useful for SupportedStyles. (@alexdowad)
- #1566: When autocorrecting on Windows, line endings are not converted to "\r\n" in untouched portions of the source files; corrected portions may use "\n" rather than "\r\n". (@alexdowad)
- New
rake repl
task can be used for experimentation when working on RuboCop. (@alexdowad) Lint/SpaceBeforeFirstArg
cop has been removed, since it just duplicatesStyle/SingleSpaceBeforeFirstArg
. (@alexdowad)Style/SingleSpaceBeforeFirstArg
cop has been renamed toStyle/SpaceBeforeFirstArg
, which more accurately reflects what it now does. (@alexdowad)Style/UnneededPercentQ
reports%q()
strings with what only appears to be an escape, but is not really (there are no escapes in%q()
strings). (@alexdowad)Performance/StringReplacement
,Performance\StartWith
, andPerformance\EndWith
more accurately identify code which can be improved. (@alexdowad)- The
MultiSpaceAllowedForOperators
config parameter forStyle/SpaceAroundOperators
has been removed, as it is made redundant byAllowForAlignment
. If someone attempts to use it, config validation will fail with a helpful message. (@alexdowad) - The
RunRailsCops
config parameter in .rubocop.yml is now obsolete. If someone attempts to use it, config validation will fail with a helpful message. (@alexdowad) - If .rubocop.yml contains configuration for a custom cop, no warning regarding "unknown cop" will be printed. The custom cop must inherit from RuboCop::Cop::Cop, and must be loaded into memory for this to work. (@alexdowad)
- #2102: If .rubocop.yml exists in the working directory when running --auto-gen-config, any
Exclude
config parameters in .rubocop.yml will be merged into the generated .rubocop_todo.yml. (@alexdowad) - #1895: Remove
Rails/DefaultScope
cop. (@alexdowad) - #2550: New
TargetRubyVersion
configuration parameter can be used to specify which version of the Ruby interpreter the inspected code is intended to run on. (@alexdowad) - #2557:
Style/GuardClause
does not warn aboutif
nodes whose condition spans multiple lines. (@alexdowad) Style/EmptyLinesAroundClassBody
,Style/EmptyLinesAroundModuleBody
, andStyle/EmptyLinesAroundBlockBody
accept an empty body with no blank line, even if configured toempty_lines
style. This is because the empty lines only serve to provide a break between the header, body, and footer, and are redundant if there is no body. (@alexdowad)- #2554:
Style/FirstMethodArgumentLineBreak
handles implicit hash arguments without braces;Style/FirstHashElementLineBreak
still handles those with braces. (@alexdowad) Style/TrailingComma
has been split intoStyle/TrailingCommaInArguments
andStyle/TrailingCommaInLiteral
. (@alexdowad)- RuboCop returns process exit code 2 if it fails due to bad configuration, bad CLI options, or an internal error. If it runs successfully but finds one or more offenses, it still exits with code 1, as was previously the case. This is helpful when invoking RuboCop programmatically, perhaps from a script. (@alexdowad)
- #2028: New config
ExtraDetails
supports addition ofDetails
param to all cops to allow extra details on offense to be displayed. (@tansaku) - #2036: New cop
Style/StabbyLambdaParentheses
will find and correct cases where a stabby lambda's paramaters are not wrapped in parentheses. (@hmadison) - #2246:
Style/TrailingUnderscoreVariable
will now register an offense for*_
. (@rrosenblum) - #2246:
Style/TrailingUnderscoreVariable
now has a configuration to remove named underscore variables (Defaulted to false). (@rrosenblum) - #2276: New cop
Performance/FixedSize
will register an offense when callinglength
,size
, orcount
on statically sized objected (strings, symbols, arrays, and hashes). (@rrosenblum) - New cop
Style/NestedModifier
checks for nestedif
,unless
,while
anduntil
modifier statements. (@lumeet) - #2270: Add a new
inherit_gem
configuration to inherit a config file from an installed gem (originally requested in #290). (@jhansche) - Allow
StyleGuide
parameters in local configuration for all cops, so users can add references to custom style guide documents. (@cornelius) UnusedMethodArgument
cop allows configuration to skip keyword arguments. (@apiology)- #2318:
Lint/Debugger
cop now checks forPry.rescue
. (@rrosenblum) - #2277: New cop
Style/FirstArrayElementLineBreak
checks for a line break before the first element in a multi-line array. (@panthomakos) - #2277: New cop
Style/FirstHashElementLineBreak
checks for a line break before the first element in a multi-line hash. (@panthomakos) - #2277: New cop
Style/FirstMethodArgumentLineBreak
checks for a line break before the first argument in a multi-line method call. (@panthomakos) - #2277: New cop
Style/FirstMethodParameterLineBreak
checks for a line break before the first parameter in a multi-line method parameter definition. (@panthomakos) - Add
Rails/PluralizationGrammar
cop, checks for incorrect grammar when using methods like3.day.ago
, when you should write3.days.ago
. (@maxjacobson) - #2347:
Lint/Eval
cop does not warn about "security risk" when eval argument is a string literal without interpolations. (@alexdowad) - #2335:
Style/VariableName
cop checks naming style of method parameters. (@alexdowad) - #2329: New style
braces_for_chaining
forStyle/BlockDelimiters
cop enforces braces on a multi-line block if its return value is being chained with another method. (@panthomakos) Lint/LiteralInCondition
warns if a symbol or dynamic symbol is used as a condition. (@alexdowad)- #2369:
Style/TrailingComma
doesn't add a trailing comma to a multiline method chain which is the only arg to a method call. (@alexdowad) CircularArgumentReference
cop updated to lint for ordinal circular argument references on top of optional keyword arguments. (@maxjacobson)- Added ability to download shared rubocop config files from remote urls. (@ptrippett)
- #1601: Add
IgnoreEmptyMethods
config parameter forLint/UnusedMethodArgument
andIgnoreEmptyBlocks
config parameter forLint/UnusedBlockArgument
cops. (@alexdowad) - #1729:
Style/MethodDefParentheses
supports new 'require_no_parentheses_except_multiline' style. (@alexdowad) - #2173:
Style/AlignParameters
also checks parameter alignment for method definitions. (@alexdowad) - #1825: New
NameWhitelist
configuration parameter forStyle/PredicateName
can be used to suppress errors on known-good predicate names. (@alexdowad) Style/Documentation
recognizes 'Constant = Class.new' as a class definition. (@alexdowad)- #1608: Add new 'align_braces' style for
Style/IndentHash
. (@alexdowad) Style/Next
can autocorrect. (@alexdowad)
- #2265: Handle unary
+
inExtraSpacing
cop. (@jonas054) - #2275: Copy default
Exclude
intoExclude
lists in.rubocop_todo.yml
. (@jonas054) Style/IfUnlessModifier
accepts blocks followed by a chained call. (@lumeet)- #2261: Make relative
Exclude
paths in$HOME/.rubocop_todo.yml
be relative to current directory. (@jonas054) - #2286: Handle auto-correction of empty method when
AllowIfMethodIsEmpty
isfalse
inStyle/SingleLineMethods
. (@jonas054) - #2246: Do not register an offense for
Style/TrailingUnderscoreVariable
when the underscore variable is preceeded by a splat variable. (@rrosenblum) - #2292: Results should not be stored in the cache if affected by errors (crashes). (@jonas054)
- #2280: Avoid reporting space between hash literal keys and values in
Style/ExtraSpacing
. (@jonas054) - #2284: Fix result cache being shared between ruby versions. (@miquella)
- #2285: Fix
ConfigurableNaming#class_emitter_method?
error when handling singleton class methods. (@palkan) - #2295: Fix Performance/Detect autocorrect to handle rogue newlines. (@palkan)
- #2294: Do not register an offense in
Performance/StringReplacement
for regex with options. (@rrosenblum) - Fix
Style/UnneededPercentQ
condition for single-quoted literal containing interpolation-like string. (@eagletmt) - #2324: Handle
--only Lint/Syntax
and--except Lint/Syntax
correctly. (@jonas054) - #2317: Handle
case
as an argument correctly inLint/EndAlignment
. (@lumeet) - #2287: Fix auto-correct of lines with only whitespace in
Style/IndentationWidth
. (@lumeet) - #2331: Do not register an offense in
Performance/Size
forcount
with an argument. (@rrosenblum) - Handle a backslash at the end of a line in
Style/SpaceAroundOperators
. (@lumeet) - Don't warn about lack of "leading space" in a =begin/=end comment. (@alexdowad)
- #2307: In
Lint/FormatParameterMismatch
, don't register an offense if either argument to % is not a literal. (@alexdowad) - #2356:
Style/Encoding
will now place the encoding comment on the second line if the first line is a shebang. (@rrosenblum) Style/InitialIndentation
cop doesn't error out when a line begins with an integer literal. (@alexdowad)- #2296: In
Style/DotPosition
, don't "correct" (and break) a method call which has a line comment (or blank line) between the dot and the selector. (@alexdowad) - #2272:
Lint/NonLocalExitFromIterator
does not warn aboutreturn
in a block which is passed toModule#define_method
. (@alexdowad) - #2262: Replace
Rainbow
reference withColorizable#yellow
. (@minustehbare) - #2068: Display warning if
Style/Copyright
is misconfigured. (@alexdowad) - #2321: In
Style/EachWithObject
, don't replace reduce with each_with_object if the accumulator parameter is assigned to in the block. (@alexdowad) - #1981:
Lint/UselessAssignment
doesn't erroneously identify assignments in identical if branches as useless. (@alexdowad) - #2323:
Style/IfUnlessModifier
cop parenthesizes autocorrected code when necessary due to operator precedence, to avoid changing its meaning. (@alexdowad) - #2003: Make
Lint/UnneededDisable
work with--auto-correct
. (@jonas054) - Default RuboCop cache dir moved to per-user folders. (@br3nda)
- #2393:
Style/MethodCallParentheses
doesn't fail onobj.method ||= func()
. (@alexdowad) - #2344: When autocorrecting,
Style/ParallelAssignment
reorders assignment statements, if necessary, to avoid breaking code. (@alexdowad) Style/MultilineOperationAlignment
does not try to align the receiver and selector of a method call if both are on the LHS of an assignment. (@alexdowad)
- #2232: Fix false positive in
Lint/FormatParameterMismatch
for argument with splat operator. (@dreyks) - #2237: Allow
Lint/FormatParameterMismatch
to be called usingKernel.format
andKernel.sprintf
. (@rrosenblum) - #2234: Do not register an offense for
Lint/FormatParameterMismatch
when the format string is a variable. (@rrosenblum) - #2240:
Lint/UnneededDisable
should not report non-Lint
rubocop:disable
comments when runningrubocop --lint
. (@jonas054) - #2121: Allow space before values in hash literals in
Style/ExtraSpacing
to avoid correction conflict. (@jonas054) - #2241: Read cache in binary format. (@jonas054)
- #2247: Fix auto-correct of
Performance/CaseWhenSplat
for percent arrays (%w
,%W
,%i
, and%I
). (@rrosenblum) - #2244: Disregard annotation keywords in
Style/CommentAnnotation
if they don't start a comment. (@jonas054) - #2257: Fix bug where
Style/RescueEnsureAlignment
will register an offense forrescue
andensure
on the same line. (@rrosenblum) - #2255: Refine the offense highlighting for
Style/SymbolProc
. (@bbatsov) - #2260: Make
Exclude
in.rubocop_todo.yml
work when running from a subdirectory. (@jonas054)
- #2248: Allow block-pass in
Style/AutoResourceCleanup
. (@lumeet) - #2258:
Style/Documentation
will exclude test directories by default. (@rrosenblum) - #2260: Disable
Style/StringMethods
by default. (@bbatsov)
- #2212: Handle methods without parentheses in auto-correct. (@karreiro)
- #2214: Fix
File name too long error
whenSTDIN
option is provided. (@mrfoto) - #2217: Allow block arguments in
Style/SymbolProc
. (@lumeet) - #2213: Write to cache with binary encoding to avoid transcoding exceptions in some locales. (@jonas054)
- #2218: Fix loading config error when safe yaml is only partially loaded. (@maxjacobson)
- #2161: Allow an explicit receiver (except
Kernel
) inStyle/SignalException
. (@lumeet)
- #2143: New cop
Performance/CaseWhenSplat
will identify and rearangecase
when
statements that contain awhen
condition with a splat. (@rrosenblum) - New cop
Lint/DuplicatedKey
checks for duplicated keys in hashes, which Ruby 2.2 warns against. (@sliuu) - #2106: Add
SuspiciousParamNames
option toStyle/OptionHash
. (@wli) - #2193:
Style/Next
supports moreEnumerable
methods. (@rrosenblum) - #2179: Add
--list-target-files
option to CLI, which prints the files which will be inspected. (@maxjacobson) - New cop
Style/MutableConstant
checks for assignment of mutable objects to constants. (@bbatsov) - New cop
Style/RedudantFreeze
checks for usages ofObject#freeze
on immutable objects. (@bbatsov) - #1924: New option
--cache
and configuration parameterAllCops: UseCache
turn result caching on (default) or off. (@jonas054) - #2204: New cop
Style/StringMethods
will check for preferred methodto_sym
overintern
. (@imtayadeway)
- #1351: Allow class emitter methods in
Style/MethodName
. (@jonas054) - #2126:
Style/RescueModifier
can now auto-correct. (@rrosenblum) - #2109: Allow alignment with a token on the nearest line with same indentation in
Style/ExtraSpacing
. (@jonas054) Lint/EndAlignment
handles thecase
keyword. (@lumeet)- #2146: Add STDIN support. (@caseywebdev)
- #2175: Files that are excluded from a cop (e.g. using the
Exclude:
config option) are no longer being processed by that cop. (@bquorning) Rails/ActionFilter
now handles complete list of methods found in the Rails 4.2 release notes. (@MGerrior)- *2138: Change the offense in
Style/Next
to highlight the condition instead of the iteration. (@rrosenblum) Style/EmptyLineBetweenDefs
now handles class methods as well. (@unmanbearpig)- Improve handling of
super
inStyle/SymbolProc
. (@lumeet) Style/SymbolProc
is applied to methods receiving arguments. (@lumeet)- #1839: Remove Rainbow monkey patching of String which conflicts with other gems like colorize. (@daviddavis)
Style/HashSyntax
is now a bit faster when checking Ruby 1.9 syntax hash keys. (@bquorning)Lint/DeprecatedClassMethods
is now a whole lot faster. (@bquorning)Lint/BlockAlignment
,Style/IndentationWidth
, andStyle/MultilineOperationIndentation
are now quite a bit faster. (@bquorning)
- #2123: Fix handing of dynamic widths
Lint/FormatParameterMismatch
. (@edmz) - #2116: Fix named params (using hash)
Lint/FormatParameterMismatch
. (@edmz) - #2135: Ignore
super
andzsuper
nodes inStyle/SymbolProc
. (@bbatsov) - #2165: Fix a NPE in
Style/Alias
. (@bbatsov) - #2168: Fix a NPE in
Rails/TimeZone
. (@bbatsov) - #2169: Fix a NPE in
Rails/Date
. (@bbatsov) - #2105: Fix a warning that was thrown when enabling
Style/OptionHash
. (@wli) - #2107: Fix auto-correct of
Style/ParallelAssignment
for nested expressions. (@rrosenblum) - #2111: Deal with byte order mark in
Style/InitialIndentation
. (@jonas054) - #2113: Handle non-string tokens in
Style/ExtraSpacing
. (@jonas054) - #2129: Handle empty interpolations in
Style/SpaceInsideStringInterpolation
. (@lumeet) - #2119: Do not raise an error in
Style/RescueEnsureAlignment
andStyle/RescueModifier
when processing an excluded file. (@rrosenblum) - #2149: Do not register an offense in
Rails/Date
whenDate#to_time
is called with a time zone argument. (@maxjacobson) - Do not register a
Rails/TimeZone
offense when using Time.new safely. (@maxjacobson) - #2124: Fix bug in
Style/EmptyLineBetweenDefs
when there are only comments between method definitions. (@lumeet) - #2154:
Performance/StringReplacement
can auto-correct replacements with backslash in them. (@rrosenblum) - #2009: Fix bug in
RuboCop::ConfigLoader.load_file
whensafe_yaml
is required. (@eitoball) - #2155: Configuration
EndAlignment: AlignWith: variable
only applies when the operands of=
are on the same line. (@jonas054) - Fix bug in
Style/IndentationWidth
whenrescue
orensure
is preceded by an empty body. (@lumeet) - #2183: Fix bug in
Style/BlockDelimiters
when auto-correcting adjacent braces. (@lumeet) - #2199: Make
rubocop
exit with error when there are onlyLint/UnneededDisable
offenses. (@jonas054) - Fix handling of empty parentheses when auto-correcting in
Style/SymbolProc
. (@lumeet)
- #2081: New cop
Style/Send
checks for the use ofsend
and instead encourages changing it toBasicObject#__send__
orObject#public_send
(disabled by default). (@syndbg) - #2057: New cop
Lint/FormatParameterMismatch
checks for a mismatch between the number of fields expected in format/sprintf/% and what was pased to it. (@edmz) - #2010: Add
space
style for SpaceInsideStringInterpolation. (@gotrevor) - #2007: Allow any modifier before
def
, not only visibility modifiers. (@fphilipe) - #1980:
--auto-gen-config
now outputs an excluded files list for failed cops (up to a maxiumum of 15 files). (@bmorrall) - #2004: Introduced
--exclude-limit COUNT
to configure how many files--auto-gen-config
will exclude. (@awwaiid, @jonas054) - #1918: New configuration parameter
AllCops:DisabledByDefault
when set totrue
makes only cops found in user configuration enabled, which makes cop selection opt-in. (@jonas054) - New cop
Performance/StringReplacement
checks for usages ofgsub
that can be replaced withtr
ordelete
. (@rrosenblum) - #2001: New cop
Style/InitialIndentation
checks for indentation of the first non-blank non-comment line in a file. (@jonas054) - #2060: New cop
Style/RescueEnsureAlignment
checks for bad alignment ofrescue
andensure
keywords. (@lumeet) - New cop
Style/OptionalArguments
checks for optional arguments that do not appear at the end of an argument list. (@rrosenblum) - New cop
Lint/CircularArgumentReference
checks for "circular argument references" in keyword arguments, which Ruby 2.2 warns against. (@maxjacobson, @sliuu) - #2030: New cop
Style/OptionHash
checks for option hashes and encourages changing them to keyword arguments (disabled by default). (@maxjacobson)
- #2052:
Style/RescueModifier
uses token stream to identify offenses. (@urbanautomaton) - Rename
Rails/Date
andRails/TimeZone
style names to "strict" and "flexible" and make "flexible" to be default. (@palkan) - #2035:
Style/ExtraSpacing
is now enabled by default and has a configuration parameterAllowForAlignment
that istrue
by default, making it allow extra spacing if it's used for alignment purposes. (@jonas054)
- #2014: Fix
Style/TrivialAccessors
to support AllowPredicates: false. (@gotrevor) - #1988: Fix bug in
Style/ParallelAssignment
when assigning fromModule::CONSTANT
. (@rrosenblum) - #1995: Improve message for
Rails/TimeZone
. (@palkan) - #1977: Fix bugs in
Rails/Date
andRails/TimeZone
when using namespaced Time/Date. (@palkan) - #1973: Do not register an offense in
Performance/Detect
whenselect
is called onEnumerable::Lazy
. (@palkan) - #2015: Fix bug occurring for auto-correction of a misaligned
end
in a file with only one method. (@jonas054) - Allow string interpolation segments inside single quoted string literals when double quotes are preferred. (@segiddins)
- #2026: Allow
Time.current
when style is "acceptable".(@palkan) - #2029: Fix bug where
Style/RedundantReturn
auto-corrects returning implicit hashes to invalid syntax. (@rrosenblum) - #2021: Fix bug in
Style/BlockDelimiters
when asemantic
expression is used in an array or a range. (@lumeet) - #1992: Allow parentheses in assignment to a variable with the same name as the method's in
Style/MethodCallParentheses
. (@lumeet) - #2045: Fix crash in
Style/IndentationWidth
when usingprivate_class_method def self.foo
syntax. (@unmanbearpig) - #2006: Fix crash in
Style/FirstParameterIndentation
in case of nested offenses. (@unmanbearpig) - #2059: Don't check for trivial accessors in modules. (@bbatsov)
- Add proper punctuation to the end of offense messages, where it is missing. (@lumeet)
- #2071: Keep line breaks in place on WordArray autocorrect.(@unmanbearpig)
- #2075: Properly correct
Style/PercentLiteralDelimiters
with escape characters in them. (@rrosenblum) - #2023: Avoid auto-correction corruption in
IndentationWidth
. (@jonas054) - #2080: Properly parse code in
Performance/Count
when callingselect..count
in a class that extends an enumerable. (@rrosenblum) - #2093: Fix bug in
Style/OneLineConditional
which should not raise an offense with an 'if/then/end' statement. (@sliuu)
Debugger
cop now checks catches methods called with arguments. (@crazydog115)
- Make it possible to disable
Lint/UnneededDisable
. (@jonas054) - #1958: Show name of
Lint/UnneededDisable
when-D/--display-cop-names
is given. (@jonas054) - Do not show
Style/NonNilCheck
offenses as corrected when the source code is not modified. (@rrosenblum) - Fix auto-correct in
Style/RedundantReturn
whenreturn
has no arguments. (@lumeet) - #1955: Fix false positive for
Style/TrailingComma
cop. (@mattjmcnaughton) - #1928: Avoid auto-correcting two alignment offenses in the same area at the same time. (@jonas054)
- #1964: Fix
RedundantBegin
auto-correct issue with comments by doing a smaller correction. (@jonas054) - #1978: Don't count disabled offences if fail-level is autocorrect. (@sch1zo)
- #1986: Fix Date false positives on variables. (@palkan)
- #1708: Improve message for
FirstParameterIndentation
. (@tejasbubane) - #1959: Allow
Lint/UnneededDisable
to be inline disabled. (@rrosenblum)
- Adjust behavior of
TrailingComma
cop to account for multi-line hashes nested within method calls. (@panthomakos) - #1719: Display an error and abort the program if input file can't be found. (@matugm)
- New cop
SpaceInsideStringInterpolation
checks for spaces within string interpolations. (@glasnt) - New cop
NestedMethodDefinition
checks for method definitions inside other methods. (@ojab) LiteralInInterpolation
cop does auto-correction. (@tmr08c)- #1865: New cop
Lint/UnneededDisable
checks forrubocop:disable
comments that can be removed. (@jonas054) EmptyElse
cop does auto-correction. (@lumeet)- Show reference links when displaying style guide links. (@rrosenblum)
Debugger
cop now checks for the Capybara debug methodsave_screenshot
. (@crazydog115)- #1282:
CaseIndentation
cop does auto-correction. (@lumeet) - #1928: Do auto-correction one offense at a time (rather than one cop at a time) if there are tabs in the code. (@jonas054)
- Prefer
SpaceInsideBlockBraces
toSpaceBeforeSemicolon
andSpaceAfterSemicolon
to avoid an infinite loop when auto-correcting. (@lumeet) - #1873: Move
ParallelAssignment
cop from Performance to Style. (@rrosenblum) - Add
getlocal
to acceptable methods ofRails/TimeZone
. (@ojab) - #1851, #1948: Change offense message for
ClassLength
andModuleLength
to match that ofMethodLength
. (@bquorning)
- Don't count required keyword args when specifying
CountKeywordArgs: false
forParameterLists
. (@sumeet) - #1879: Avoid auto-correcting hash with trailing comma into invalid code in
BracesAroundHashParameters
. (@jonas054) - #1868: Do not register an offense in
Performance/Count
whenselect
is called with symbols or strings as the parameters. (@rrosenblum) Sample
rewritten to properly handle shuffle randomness source, first/last params and non-literal ranges. (@chastell)- #1873: Modify
ParallelAssignment
to properly autocorrect when the assignment is protected by a modifier statement. (@rrosenblum) - Configure
ParallelAssignment
to work with non-standardIndentationWidths
. (@rrosenblum) - #1899: Be careful about comments when auto-correcting in
BracesAroundHashParameters
. (@jonas054) - #1897: Don't report that semicolon separated statements can be converted to modifier form in
IfUnlessModifier
(and don't auto-correct them). (@jonas054) - #1644: Don't search the entire file system when a folder is named
,
(fix for jruby and rbx). (@rrosenblum) - #1803: Don't warn for
return
fromlambda
block inNonLocalExitFromIterator
. (@ypresto) - #1905: Ignore sparse and trailing comments in
Style/Documentation
. (@RGBD) - #1923: Handle properly
for
without body inStyle/Next
. (@bbatsov) - #1901: Do not auto correct comments that are missing a note. (@rrosenblum)
- #1926: Fix crash in
Style/AlignHash
when correcting a hash with a splat in it. (@rrosenblum) - #1935: Allow
Symbol#to_proc
blocks in Performance/Size. (@m1foley)
Rails/TimeZone
emits acceptable methods on a violation whenEnforcedStyle
is:acceptable
. (@l8nite)- Recognize rackup file (config.ru) out of the box. (@carhartl)
- #1788: New cop
ModuleLength
checks for overly long module definitions. (@sdeframond) - New cop
Performance/Count
to convertEnumerable#select...size
,Enumerable#reject...size
,Enumerable#select...count
,Enumerable#reject...count
Enumerable#select...length
, andEnumerable#reject...length
toEnumerable#count
. (@rrosenblum) CommentAnnotation
cop does auto-correction. (@dylandavidson)- New cop
Style/TrailingUnderscoreVariable
to remove trailing underscore variables from mass assignment. (@rrosenblum) - #1136: New cop
Performance/ParallelAssignment
to avoid usages of unnessary parallel assignment. (@rrosenblum) - #1278:
DefEndAlignment
andEndAlignment
cops do auto-correction. (@lumeet) IndentationWidth
cop follows theAlignWith
option of theDefEndAlignment
cop. (@lumeet)- #1837: New cop
EachWithObjectArgument
checks thateach_with_object
isn't called with an immutable object as argument. (@jonas054) ArrayJoin
cop does auto-correction. (@tmr08c)
- #1816: Fix bug in
Sample
when calling#shuffle
with something other than an element selector. (@rrosenblum) - #1768:
DefEndAlignment
recognizes precedingprivate_class_method
orpublic_class_method
beforedef
. (@til) - #1820: Correct the logic in
AlignHash
for when to ignore a key because it's not on its own line. (@jonas054) - #1829: Fix bug in
Sample
andFlatMap
that would cause them to report having been auto-corrected when they were not. (@rrosenblum) - #1832: Fix bug in
UnusedMethodArgument
that would cause them to report having been auto-corrected when they were not. (@jonas054) - #1834: Support only boolean values for
AutoCorrect
configuration parameter, and remove warning for unknown parameter. (@jonas054) - #1843: Fix crash in
TrailingBlankLines
when a file ends with a block comment without final newline. (@jonas054) - #1849: Fix bug where you can not have nested arrays in the Rake task configuration. (@rrosenblum)
- Fix bug in
MultilineTernaryOperator
where it will not register an offense when only the false branch is on a separate line. (@rrosenblum) - Fix crash in
MultilineBlockLayout
when using new lambda literal syntax without parentheses. (@hbd225) - #1859: Fix bugs in
IfUnlessModifier
concerning comments and empty lines. (@jonas054) - Fix handling of trailing comma in
SpaceAroundBlockParameters
andSpaceAfterComma
. (@lumeet)
- #1691: For assignments with line break after
=
, usekeyword
alignment inEndAlignment
regardless of configured style. (@jonas054) - #1769: Fix bug where
LiteralInInterpolation
registers an offense for interpolation of__LINE__
. (@rrosenblum) - #1773: Fix typo ('strptime' -> 'strftime') in
Rails/TimeZone
. (@palkan) - #1777: Fix offense message from Rails/TimeZone. (@mzp)
- #1784: Add an explicit error message when config contains an empty section. (@bankair)
- #1791: Fix autocorrection of
PercentLiteralDelimiters
with no content. (@cshaffer) - Fix handling of
while
anduntil
with assignment inIndentationWidth
. (@lumeet) - #1793: Fix bug in
TrailingComma
that caused,
in comment to count as a trailing comma. (@jonas054) - #1765: Update 1.9 hash to stop triggering when the symbol is not valid in the 1.9 hash syntax. (@crimsonknave)
- #1806: Require a newer version of
parser
and use its corrected solution for comment association inStyle/Documentation
. (@jonas054) - #1792: Fix bugs in
Sample
that did not account for array selectors with a range and passing random to shuffle. (@rrosenblum) - #1770: Add more acceptable methods to
Rails/TimeZone
(utc
,localtime
,to_i
,iso8601
etc). (@palkan) - #1767: Do not register offenses on non-enumerable select/find_all by
Performance/Detect
. (@palkan) - #1795: Fix bug in
TrailingBlankLines
that caused a crash for files containing only newlines. (@renuo)
- #1600: Add
line_count_based
andsemantic
styles to theBlockDelimiters
(formerlyBlocks
) cop. (@clowder, @mudge) - #1712: Set
Offense#corrected?
totrue
,false
, ornil
when it was, wasn't, or can't be auto-corrected, respectively. (@vassilevsky) - #1669: Add command-line switch
--display-style-guide
. (@marxarelli) - #1405: Add Rails TimeZone and Date cops. (@palkan)
- #1641: Add ruby19_no_mixed_keys style to
HashStyle
cop. (@iainbeeston) - #1604: Add
IgnoreClassMethods
option toTrivialAccessors
cop. (@bbatsov) - #1651: The
Style/SpaceAroundOperators
cop now also detects extra spaces around operators. A list of operators that may be surrounded by multiple spaces is configurable. (@bquorning) - Add auto-correct to
Encoding
cop. (@rrosenblum) - #1621:
TrailingComma
has a new styleconsistent_comma
. (@tamird) - #1611: Add
empty
,nil
, andboth
SupportedStyles
toEmptyElse
cop. Default isboth
. (@rrosenblum) - #1611: Add new
MissingElse
cop. Default is to have this cop be disabled. (@rrosenblum) - #1602: Add support for
# :nodoc
inDocumentation
. (@lumeet) - #1437: Modify
HashSyntax
cop to allow the use of hash rockets for hashes that have symbol values when using ruby19 syntax. (@rrosenblum) - New cop
Style/SymbolLiteral
makes sure you're not using the string within symbol syntax unless it's needed. (@bbatsov) - #1657: Autocorrect can be turned off on a specific cop via the configuration. (@jdoconnor)
- New cop
Style/AutoResourceCleanup
suggests the use of block taking versions of methods that do resource cleanup. (@bbatsov) - #1275:
WhileUntilModifier
cop does auto-correction. (@lumeet) - New cop
Performance/ReverseEach
to convertreverse.each
toreverse_each
. (@rrosenblum) - #1281:
IfUnlessModifier
cop does auto-correction. (@lumeet) - New cop
Performance/Detect
to detect usage ofselect.first
,select.last
,find_all.first
, andfind_all.last
and convert them to usedetect
instead. (@palkan, @rrosenblum) - #1728: New cop
NonLocalExitFromIterator
checks for misusedreturn
in block. (@ypresto) - New cop
Performance/Size
to convert calls tocount
onArray
andHash
tosize
. (@rrosenblum) - New cop
Performance/Sample
to convert usages ofshuffle.first
,shuffle.last
, andshuffle[Fixnum]
tosample
. (@rrosenblum) - New cop
Performance/FlatMap
to convertEnumerable#map...Array#flatten
andEnumerable#collect...Array#flatten
toEnumerable#flat_map
. (@rrosenblum) - #1144: New cop
ClosingParenthesisIndentation
checks the indentation of hanging closing parentheses. (@jonas054) - New Rails cop
FindBy
identifies usages ofwhere.first
andwhere.take
. (@bbatsov) - New Rails cop
FindEach
identifies usages ofall.each
. (@bbatsov) - #1342:
IndentationConsistency
is now configurable with the stylesnormal
andrails
. (@jonas054)
- #1705: Fix crash when reporting offenses of
MissingElse
cop. (@gerry3) - #1659: Fix stack overflow with JRuby and Windows 8, during initial config validation. (@pimterry)
- #1694: Ignore methods with a
blockarg
inTrivialAccessors
. (@bbatsov) - #1617: Always read the html output template using utf-8. (@bbatsov)
- #1684: Ignore symbol keys like
:"string"
inHashSyntax
. (@bbatsov) - Handle explicit
begin
blocks inLint/Void
. (@bbatsov) - Handle symbols in
Lint/Void
. (@bbatsov) - #1695: Fix bug with
--auto-gen-config
andSpaceInsideBlockBraces
. (@meganemura) - Correct issues with whitespace around multi-line lambda arguments. (@zvkemp)
- #1579: Fix handling of similar-looking blocks in
BlockAlignment
. (@lumeet) - #1676: Fix auto-correct in
Lambda
when a new multi-line lambda is used as an argument. (@lumeet) - #1656: Fix bug that would include hidden directories implicitly. (@jonas054)
- #1728: Fix bug in
LiteralInInterpolation
andAssignmentInCondition
. (@ypresto) - #1735: Handle trailing space in
LineEndConcatenation
autocorrect. (@jonas054) - #1750: Escape offending code lines output by the HTML formatter in case they contain markup. (@jonas054)
- #1541: No inspection of text that follows
__END__
. (@jonas054) - Fix comment detection in
Style/Documentation
. (@lumeet) - #1637: Fix handling of
binding
calls inUnusedBlockArgument
andUnusedMethodArgument
. (@lumeet)
- #1397:
UnneededPercentX
renamed toCommandLiteral
. The cop can be configured to enforce using either%x
or backticks around command literals, or using%x
around multi-line commands and backticks around single-line commands. The cop ignores heredoc commands. (@bquorning) - #1020: Removed the
MaxSlashes
configuration option forRegexpLiteral
. Instead, the cop can be configured to enforce using either%r
or slashes around regular expressions, or using%r
around multi-line regexes and slashes around single-line regexes. (@bquorning) - #1734: The default exclusion of hidden directories has been optimized for speed. (@jonas054)
- #1673:
Style/TrivialAccessors
now requires matching names by default. (@bbatsov)
- #1638: Use Parser functionality rather than regular expressions for matching comments in
FirstParameterIndentation
. (@jonas054) - #1642: Raise the correct exception if the configuration file is malformed. (@bquorning)
- #1647: Skip
SpaceAroundBlockParameters
when lambda has no argument. (@eitoball) - #1649: Handle exception assignments in
UselessSetterCall
. (@bbatsov) - #1644: Don't search the entire file system when a folder is named
,
. (@bquorning)
- #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) - #1144: New cop
FirstParameterIndentation
checks the indentation of the first parameter in a method call. (@jonas054) - #1627: New cop
SpaceAroundBlockParameters
checks the spacing inside and after block parameters pipes. (@jonas054)
- #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)
- #1634: Fix
PerlBackrefs
Cop Autocorrections to Not Raise. (@cshaffer) - #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) - #1598: Fix bug in file inclusion when running from another directory. (@jonas054)
- #1580: Don't print
[Corrected]
when auto-correction was avoided inTrivialAccessors
. (@lumeet) - #1612: Allow
expand_path
oninherit_from
in.rubocop.yml
. (@mattjmcnaughton) - #1610: Check that class method names actually match the name of the containing class/module in
Style/ClassMethods
. (@bbatsov)
- #1450: 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.