Yassin Kammoun af51542e42
Modify S1116: Migrate to LayC (#3320)
## Review

A dedicated reviewer checked the rule description successfully for:

- [ ] logical errors and incorrect information
- [ ] information gaps and missing content
- [ ] text style and tone
- [ ] PR summary and labels follow [the
guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)

---------

Co-authored-by: Angelo Buono <angelo.buono@sonarsource.com>
2023-10-18 13:53:57 +02:00

63 lines
1.1 KiB
Plaintext

== Why is this an issue?
include::../description.adoc[]
=== Code examples
==== Noncompliant code example
[source,csharp,diff-id=1,diff-type=noncompliant]
----
void DoSomething()
{
; // Noncompliant - was used as a kind of TODO marker
}
void DoSomethingElse()
{
Console.WriteLine("Hello, world!");; // Noncompliant - double ;
// ...
// Rarely, they are used on purpose as the body of a loop. It is a bad practice to
// have side-effects outside of the loop:
for (int i = 0; i < 3; Console.WriteLine(i), i++); // Noncompliant
// ...
}
----
==== Compliant solution
[source,csharp,diff-id=1,diff-type=compliant]
----
void DoSomething()
{
}
void DoSomethingElse()
{
Console.WriteLine("Hello, world!");
// ...
for (int i = 0; i < 3; i++)
{
Console.WriteLine(i);
}
// ...
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]