New features
- #5101: Allow to specify
TargetRubyVersion
2.5. (@walf443) - #1575: Add new
Layout/ClassStructure
cop that checks whether definitions in a class are in the configured order. This cop is disabled by default. (@jonatas) - New cop
Rails/InverseOf
checks for association arguments that require setting theinverse_of
option manually. (@bdewater) - #4811: Add new
Layout/SpaceInsideReferenceBrackets
cop. (@garettarrowood) - #4811: Add new
Layout/SpaceInsideArrayLiteralBrackets
cop. (@garettarrowood) - #4252: Add new
Style/TrailingBodyOnMethodDefinition
cop. (@garettarrowood) - Add new
Style/TrailingMethodEndStatment
cop. (@garettarrowood) - #5074: Add Layout/EmptyLinesAroundArguments cop. (@garettarrowood)
- #4650: Add new
Style/StringHashKeys
cop. (@donjar) - #1583: Add a quiet formatter. (@drenmi)
- Add new
Style/RandomWithOffset
cop. (@donjar) - #4892: Add new
Lint/ShadowedArgument
cop and remove argument shadowing detection fromLint/UnusedBlockArgument
andLint/UnusedMethodArgument
. (@akhramov) - #4674: Add a new
Lint/MissingCopEnableDirective
cop. (@tdeo) - Add new
Rails/EnvironmentComparison
cop. (@tdeo) - Add
AllowedChars
option toStyle/AsciiComments
cop. (@hedgesky) - #5031: Add new
Style/EmptyBlockParameter
andStyle/EmptyLambdaParameter
cops. (@pocke) - #5057: Add new
Gemspec/RequiredRubyVersion
cop. (@koic) - #5087: Add new
Gemspec/RedundantAssignment
cop. (@koic) - Add
unannotated
option toStyle/FormatStringToken
cop. (@drenmi) - #5077: Add new
Rails/CreateTableWithTimestamps
cop. (@wata727) - Add new
Style/ColonMethodDefinition
cop. (@rrosenblum) - Add new
Style/ExtendSelf
cop. (@drenmi) - #5185: Add new
Rails/RedundantReceiverInWithOptions
cop. (@koic) - #5177: Add new
Rails/LexicallyScopedActionFilter
cop. (@wata727) - #5173: Add new
Style/EvalWithLocation
cop. (@pocke) - #5208: Add new
Rails/Presence
cop. (@wata727)
Bug fixes
- #5096: Fix incorrect detection and autocorrection of multiple extend/include/prepend. (@marcandre)
- #5219: Fix incorrect empty line detection for block arguments in
Layout/EmptyLinesAroundArguments
. (@garettarrowood) - #4662: Fix incorrect indent level detection when first line of heredoc is blank. (@sambostock)
- #5016: Fix a false positive for
Style/ConstantName
with constant names using non-ASCII capital letters with accents. (@timrogers) - #4866: Prevent
Layout/BlockEndNewline
cop from introducing trailing whitespaces. (@bgeuken) - #3396: Concise error when config. file not found. (@jaredbeck)
- #4881: Fix a false positive for
Performance/HashEachMethods
when unused argument(s) exists in other blocks. (@pocke) - #4883: Fix auto-correction for
Performance/HashEachMethods
. (@pocke) - #4896: Fix Style/DateTime wrongly triggered on classes
...::DateTime
. (@dpostorivo) - #4938: Fix behavior of
Lint/UnneededDisable
, which was returning offenses even after being disabled in a comment. (@tdeo) - #4887: Add undeclared configuration option
EnforcedStyleForEmptyBraces
forLayout/SpaceBeforeBlockBraces
cop. (@drenmi) - #4987: Skip permission check when using stdin option. (@mtsmfm)
- #4909: Make
Rails/HasManyOrHasOneDependent
aware of multiple associations inwith_options
. (@koic) - #4794: Fix an error in
Layout/MultilineOperationIndentation
when an operation spans multiple lines and contains a ternary expression. (@rrosenblum) - #4885: Fix false offense detected by
Style/MixinUsage
cop. (@koic) - #3363: Fix
Style/EmptyElse
autocorrection removes comments from branches. (@dpostorivo) - #5025: Fix error with Layout/MultilineMethodCallIndentation cop and lambda.(...). (@dpostorivo)
- #4781: Prevent
Style/UnneededPercentQ
from breaking on strings that are concated with backslash. (@pocke) - #4363: Fix
Style/PercentLiteralDelimiters
incorrectly automatically modifies escaped percent literal delimiter. (@koic) - #5053: Fix
Naming/ConstantName
false offense on assigning to a nonoffensive assignment. (@garettarrowood) - #5019: Fix auto-correct for
Style/HashSyntax
cop when hash is used as unspaced argument. (@drenmi) - #5052: Improve accuracy of
Style/BracesAroundHashParameters
auto-correction. (@garettarrowood) - #5059: Fix a false positive for
Style/MixinUsage
wheninclude
call is a method argument. (@koic) - #5071: Fix a false positive in
Lint/UnneededSplatExpansion
, whenArray.new
resides in an array literal. (@akhramov) - #4071: Prevent generating wrong code by Style/ColonMethodCall and Style/RedundantSelf. (@pocke)
- #5089: Fix false positive for
Style/SafeNavigation
when safe guarding arithmetic operation or assignment. (@tiagotex) - #5099: Prevent
Style/MinMax
from breaking on implicit receivers. (@drenmi) - #5079: Fix false positive for
Style/SafeNavigation
when safe guarding comparisons. (@tiagotex) - #5075: Fix auto-correct for
Style/RedundantParentheses
cop when unspaced ternary is present. (@tiagotex) - #5155: Fix a false negative for
Naming/ConstantName
cop when using frozen object assignment. (@koic) - Fix a false positive in
Style/SafeNavigation
when the right hand side is negated. (@rrosenblum) - #5128: Fix
Bundler/OrderedGems
when gems are references from variables (ignores them in the sorting). (@tdeo)
Changes
- #4848: Exclude lambdas and procs from
Metrics/ParameterLists
. (@reitermarkus) - #5120: Improve speed of RuboCop::PathUtil#smart_path. (@walf443)
- #4888: Improve offense message of
Style/StderrPuts
. (@jaredbeck) - #4886: Fix false offense for Style/CommentedKeyword. (@michniewicz)
- #4977: Make
Lint/RedundantWithIndex
cop aware of offset argument. (@koic) - #2679: Handle dependencies to
Metrics/LineLength: Max
when generating.rubocop_todo.yml
. (@jonas054) - #4943: Make cop generator compliant with the repo's rubocop config. (@tdeo)
- #5011: Remove
SupportedStyles
from "Configuration parameters" in.rubocop_todo.yml
. (@pocke) Lint/RescueWithoutErrorClass
has been replaced byStyle/RescueStandardError
. (@rrosenblum)- #4811: Remove
Layout/SpaceInsideBrackets
in favor of two new configurable cops. (@garettarrowood) - #5042: Make offense locations of metrics cops to contain whole a method. (@pocke)
- #5044: Add last_line and last_column into outputs of the JSON formatter. (@pocke)
- #4633: Make metrics cops aware of
define_method
. (@pocke) - #5037: Make display cop names to enable by default. (@pocke)
- #4449: Make
Layout/IndentHeredoc
aware of line length. (@pocke) - #5146: Make
--show-cops
option aware of--force-default-config
. (@pocke) - #3001: Add configuration to
Lint/MissingCopEnableDirective
cop. (@tdeo) - #4932: Do not fail if configuration contains
Lint/Syntax
cop with the same settings as the default. (@tdeo) - #5175: Make Style/RedundantBegin aware of do-end block in Ruby 2.5. (@pocke)