BRO1129: Query clause should begin on new line when previous clause spans multiple lines¶
A clause after a clause that spans several lines starts on its own line. Replaces StyleCop SA1104.
Example¶
Before¶
using System.Linq;
public class Orders
{
public object InRange(int[] amounts) =>
from a in amounts
where a > 10 &&
a < 100 select a;
}
After¶
using System.Linq;
public class Orders
{
public object InRange(int[] amounts) =>
from a in amounts
where a > 10 &&
a < 100
select a;
}
Why¶
A clause starting at the end of a multi-line clause is easy to miss.
How the fix works¶
The clause moves to its own line, indented like BRO1128 indents clauses.
Not reported¶
- A clause after a comment on the same line (the fix would have to move the comment).
Compared with StyleCop¶
Same positions and output.