From a6f41639c68106dac27ec58705aa74c5f5632988 Mon Sep 17 00:00:00 2001 From: Benjamin Quorning Date: Thu, 16 Jun 2022 19:30:53 +0200 Subject: [PATCH] Add missing documentation change It looks like we forgot to run `rake update_cops_documentation` in the pull request #10697. I don't know how CI didn't catch this. --- docs/modules/ROOT/pages/cops.adoc | 1 + docs/modules/ROOT/pages/cops_lint.adoc | 42 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/docs/modules/ROOT/pages/cops.adoc b/docs/modules/ROOT/pages/cops.adoc index df6162b2748..73ce9ab0626 100644 --- a/docs/modules/ROOT/pages/cops.adoc +++ b/docs/modules/ROOT/pages/cops.adoc @@ -313,6 +313,7 @@ In the following section you find all available cops: * xref:cops_lint.adoc#linturiregexp[Lint/UriRegexp] * xref:cops_lint.adoc#lintuselessaccessmodifier[Lint/UselessAccessModifier] * xref:cops_lint.adoc#lintuselessassignment[Lint/UselessAssignment] +* xref:cops_lint.adoc#lintuselesselsewithoutrescue[Lint/UselessElseWithoutRescue] * xref:cops_lint.adoc#lintuselessmethoddefinition[Lint/UselessMethodDefinition] * xref:cops_lint.adoc#lintuselessruby2keywords[Lint/UselessRuby2Keywords] * xref:cops_lint.adoc#lintuselesssettercall[Lint/UselessSetterCall] diff --git a/docs/modules/ROOT/pages/cops_lint.adoc b/docs/modules/ROOT/pages/cops_lint.adoc index f675f628925..ac1418d4d28 100644 --- a/docs/modules/ROOT/pages/cops_lint.adoc +++ b/docs/modules/ROOT/pages/cops_lint.adoc @@ -6446,6 +6446,48 @@ end * https://rubystyle.guide#underscore-unused-vars +== Lint/UselessElseWithoutRescue + +|=== +| Enabled by default | Safe | Supports autocorrection | Version Added | Version Changed + +| Enabled +| Yes +| No +| 0.17 +| <> +|=== + +Checks for useless `else` in `begin..end` without `rescue`. + +NOTE: This syntax is no longer valid on Ruby 2.6 or higher. + +=== Examples + +[source,ruby] +---- +# bad + +begin + do_something +else + do_something_else # This will never be run. +end +---- + +[source,ruby] +---- +# good + +begin + do_something +rescue + handle_errors +else + do_something_else +end +---- + == Lint/UselessMethodDefinition |===