rspec/rules/S1116/csharp/rule.adoc

60 lines
1022 B
Plaintext

== Why is this an issue?
include::../description.adoc[]
=== Noncompliant code example
[source,csharp]
----
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]
----
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[]