
org.sonar.l10n.csharp.rules.csharpsquid.S127.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-csharp-plugin Show documentation
Show all versions of sonar-csharp-plugin Show documentation
Enable analysis and reporting on C# projects.
Loop counters should not be modified in the body of the loop to prevent unexpected side effects.
Noncompliant Code Example
class Foo
{
static void Main()
{
for (int i = 1; i <= 5; i++)
{
Console.WriteLine(i);
if (condition)
{
i = 20;
}
}
}
}
Compliant Solution
class Foo
{
static void Main()
{
for (int i = 1; i <= 5; i++)
{
Console.WriteLine(i);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy