From c9c56ce535e4e0dd102d34b8ba07013e304d8891 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sat, 9 May 2020 15:33:50 +0900 Subject: [PATCH] Mark unsafe for `Style/OptionalArguments` cop This PR marks unsafe for `Style/OptionalArguments` cop because changing method signature makes interface incompatible. The incompatibility between good example and bad example shows that. --- CHANGELOG.md | 1 + config/default.yml | 2 ++ lib/rubocop/cop/style/optional_arguments.rb | 2 +- manual/cops_style.md | 4 ++-- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 856f84891bc..bc0211627db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ * [#4245](https://github.com/rubocop-hq/rubocop/issues/4245): **(Breaking)** Inspect all files given on command line unless `--only-recognized-file-types` is given. ([@jonas054][]) * [#7390](https://github.com/rubocop-hq/rubocop/issues/7390): **(Breaking)** Enabling a cop overrides disabling its department. ([@jonas054][]) * [#7936](https://github.com/rubocop-hq/rubocop/issues/7936): Mark `Lint/BooleanSymbol` as unsafe. ([@laurmurclar][]) +* [#7948](https://github.com/rubocop-hq/rubocop/pull/7948): Mark unsafe for `Style/OptionalArguments`. ([@koic][]) ## 0.82.0 (2020-04-16) diff --git a/config/default.yml b/config/default.yml index 8583bb8242b..ac9a688a270 100644 --- a/config/default.yml +++ b/config/default.yml @@ -3435,7 +3435,9 @@ Style/OptionalArguments: of the argument list. StyleGuide: '#optional-arguments' Enabled: true + Safe: false VersionAdded: '0.33' + VersionChanged: '0.83' Style/OrAssignment: Description: 'Recommend usage of double pipe equals (||=) where applicable.' diff --git a/lib/rubocop/cop/style/optional_arguments.rb b/lib/rubocop/cop/style/optional_arguments.rb index c1b8f5197f1..e691efd9ff0 100644 --- a/lib/rubocop/cop/style/optional_arguments.rb +++ b/lib/rubocop/cop/style/optional_arguments.rb @@ -4,7 +4,7 @@ module RuboCop module Cop module Style # This cop checks for optional arguments to methods - # that do not come at the end of the argument list + # that do not come at the end of the argument list. # # @example # # bad diff --git a/manual/cops_style.md b/manual/cops_style.md index 2c046aa9532..4a831c631fe 100644 --- a/manual/cops_style.md +++ b/manual/cops_style.md @@ -5024,10 +5024,10 @@ SuspiciousParamNames | `options`, `opts`, `args`, `params`, `parameters` | Array Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged --- | --- | --- | --- | --- -Enabled | Yes | No | 0.33 | - +Enabled | No | No | 0.33 | 0.83 This cop checks for optional arguments to methods -that do not come at the end of the argument list +that do not come at the end of the argument list. ### Examples