From bbff53d3264e87f0a574c0dabe31a5e7369f9f60 Mon Sep 17 00:00:00 2001 From: Tim Pohlmann Date: Tue, 27 May 2025 12:27:28 +0200 Subject: [PATCH] Modify Rule S3626 to include an exception about local functions after return statements --- rules/S3626/csharp/rule.adoc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rules/S3626/csharp/rule.adoc b/rules/S3626/csharp/rule.adoc index 8b1db04666e..4e1b35e7c1b 100644 --- a/rules/S3626/csharp/rule.adoc +++ b/rules/S3626/csharp/rule.adoc @@ -1,6 +1,6 @@ == Why is this an issue? -Jump statements, such as ``++return++``, ``++yield break++``, ``++goto++``, and ``++continue++`` let you change the default flow of program execution, but jump statements that direct the control flow to the original direction are just a waste of keystrokes. +Jump statements, such as `return`, `yield break`, `goto`, and `continue` are used to change the normal flow of execution in a program. However, redundant jump statements can make code difficult to read and maintain. === Noncompliant code example @@ -41,6 +41,10 @@ void Foo() } ---- +=== Exceptions + +* `return` statements followed by a local function declaration are not considered redundant, as they help with readability. + ifdef::env-github,rspecator-view[] '''