SonarSource/sonar-dotnet

New Rule T0025: Indent ‘?’ and ‘:’ +4 further than the condition line

Opened this issue · 0 comments

Coding style:

Long ternary operator statements should have ? and : on separate lines, aligned with a left-most single indentation.

object.Property is SomeType something
&& something.AnotherProperty is OtherType other
&& other.Value == 42
    ? object.Parent.Value
    : object;

This rule doesn't care about the length of the statement (see T0024), only about the indentation.