Skip to content

NET-1484 Modify Rule S3626 to include an exception #5087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion rules/S3626/csharp/rule.adoc
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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[]

'''
Expand Down