CheckSharp.Checks.Block
ForeachStatementsMustUseBraces
Checks that statements contained in foreach statements are enclosed by braces. In this example a check violation would be written to the CheckSharp report.
foreach (condition) foo += bar;
ForStatementsMustUseBraces
Checks that statements contained in for statements are enclosed by braces. In this example a check violation would be written to the CheckSharp report.
for (condition) foo += bar;
IfElseStatementsMustUseBraces
Checks that statements contained in if statements are enclosed by braces. This check does only check if/else if/else blocks but does not check plain if statements.
// Not Checked if (condition) foo = bar; // Checked if (condition) foo = bar; else bar = foo;You can use the to check the first case.
IfStatementsMustUseBraces
Checks that statements contained in if statements are enclosed by braces. This check does not check if/else if/else blocks, just plain if statements.
// Checked if (condition) foo = bar; // Not Checked if (condition) foo = bar; else bar = foo;You can use the to check the latter case.
WhileStatementsMustUseBraces
Checks that statements contained in while statements are enclosed by braces. In this example a check violation would be written to the CheckSharp report.
while (condition) foo += bar;