CS.STMT.FOR.BLOCK
Body for for statement should be a block.
The body of a for statement must be a block enclosed by {and}.
Vulnerability and risk
If you omit the braces {} in the body of a for statement, a careless programming error may occur.
Mitigation and prevention
Use curly braces in the body of a for statement.
Example
1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 7 namespace kmcustom 8 { 9 class C18 10 { 11 public void testNGFor(int some_number) 12 { 13 for (int i = 0; i < some_number; i++) 14 i++; 15 for (int j = 0; j < some_number; j++) ; 16 } 17 public void testOKFor(int some_number) 18 { 19 for (int i = 0; i < some_number; i++) 20 { 21 i++; 22 } 23 for (int j = 0; j < some_number; j++) 24 { 25 ; 26 } 27 } 28 } 29 }