Login
assignments rule
Login

The rule to check do assignments in the code follow some design patterns. Checked things:

The syntax in a configuration file is:

[ruleType] ?not? assignments [checkType]

Disabling the rule

It is possible to disable the rule for a selected part of the checked code by using pragma ruleOff: "assignments" in the element in code before it. For example, if the rule should be disabled for assignment i = i + 1, the full declaration of it should be:

 {.ruleOff: "assignments".}
 i = i + 1

To enable the rule again, the pragma ruleOn: "assignments" should be added in the code before it. For example, if the rule should be re-enabled for a += 1, the full declaration should be:

 {.ruleOn: "assignments".}
 a += 1

Examples

  1. Check if all assignments in the code are shorthand assignments:

    check assignments shorthand

  2. Replace all shorthand assignments in the code with full assignments:

    fix not assignments shorthand