Login
forStatemets rule
Login

The rule to check do for statements in the code contains or not some expressions. Checked things:

The syntax in a configuration file is:

[ruleType] ?not? forStatements [checkType]

Disabling the rule

It is possible to disable the rule for a selected part of the checked code by using pragma ruleOff: "forStatements" in the code before it. For example, if the rule should be disabled for the selected statement, the full declaration of it should be:

 {.ruleOff: "forStatements".}
 for i in 1 .. 5:
   echo i

To enable the rule again, the pragma ruleOn: "forStatements" should be added in the code before it. For example, if the rule should be re-enabled for the statement, the full declaration should be:

 {.ruleOn: "forStatements".}
 for i in 1 .. 5:
   echo i

Examples

  1. Check if all for statements have direct calls for iterators::

    check forStatements iterators

  2. Remove all empty for statements::

    fix not forStatements empty