Skip to content

Latest commit

 

History

History
60 lines (43 loc) · 702 Bytes

RCS1208.md

File metadata and controls

60 lines (43 loc) · 702 Bytes

RCS1208: Reduce if nesting

Property Value
Id RCS1208
Category Style
Severity None

Example

Code with Diagnostic

if (condition1) // RCS1208
{
    Foo1();

    if (condition2)
    {
        Foo2();

        if (condition3)
        {
            Foo3();
        }
    }
}

Code with Fix

if (!condition1)
{
    return;
}

Foo1();

if (!condition2)
{
    return;
}

Foo2();

if (!condition3)
{
    return;
}

Foo3();

See Also

(Generated with DotMarkdown)