From d6c1b12d62bba36e52f0622b4ac36f6398d8d904 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sun, 21 Jun 2020 11:52:28 +0900 Subject: [PATCH] Mark unsafe for `Lint/RaiseException` cop Follow up https://github.com/rubocop-hq/rubocop/pull/8169#issuecomment-647012793. `Lint/RaiseException` cop is unsafe due to incompatibility between bad and good cases. ## bad case ```console % cat /tmp/example_for_exception.rb begin raise Exception rescue puts 'Handle exception' end % ruby example_for_exception.rb example_for_exception.rb:2:in `
': Exception (Exception) ``` ## good case ```console % cat example_for_starndard_error.rb begin raise StandardError rescue puts 'Handle exception' end % ruby /tmp/example_for_starndard_error.rb Handle exception ``` --- CHANGELOG.md | 1 + config/default.yml | 1 + docs/modules/ROOT/pages/cops_lint.adoc | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f90245a5b18..ce95478c163 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ * [#8146](https://github.com/rubocop-hq/rubocop/pull/8146): Use UTC in RuboCop todo file generation. ([@mauro-oto][]) * [#8149](https://github.com/rubocop-hq/rubocop/pull/8149): Cop `Metrics/CyclomaticComplexity` now counts `&.`, `||=`, `&&=` and blocks known to iterate. Default bumped from 6 to 7. ([@marcandre][]) +* [#8178](https://github.com/rubocop-hq/rubocop/pull/8178): Mark unsafe for `Lint/RaiseException`. ([@koic][]) ## 0.85.1 (2020-06-07) diff --git a/config/default.yml b/config/default.yml index 19c9ffa270f..db3aaa211d6 100644 --- a/config/default.yml +++ b/config/default.yml @@ -1620,6 +1620,7 @@ Lint/RaiseException: Description: Checks for `raise` or `fail` statements which are raising `Exception` class. StyleGuide: '#raise-exception' Enabled: pending + Safe: false VersionAdded: '0.81' AllowedImplicitNamespaces: - 'Gem' diff --git a/docs/modules/ROOT/pages/cops_lint.adoc b/docs/modules/ROOT/pages/cops_lint.adoc index fb6601b1781..2276aa32092 100644 --- a/docs/modules/ROOT/pages/cops_lint.adoc +++ b/docs/modules/ROOT/pages/cops_lint.adoc @@ -2138,7 +2138,7 @@ rather than meant to be part of the resulting symbols. | Enabled by default | Safe | Supports autocorrection | VersionAdded | VersionChanged | Pending -| Yes +| No | No | 0.81 | -