checkLoopIteratorNaming

Checks if iterator variables are prefixed with i, j, k etc. Depending on the parameters for variable casing, this can mean that iterator variables can be of the form iRow, jTest for camel case, i_row, j_test for snake case, iROW, jTEST for screaming snake case or irow, jtest for lower case. When enabled, this check fails if:

  • The iterator variable name does not start with i, j, ..., z.

  • The first character is not followed by an upper case character (lower/upper camel/snake case), a lower case character (lower case) or an underscore followed by a lower case character (snake case).

Configurable parameters

  • SubsequentLettering (boolean): True if, in nested for-loops, the starting letters of the iterator names shall be subsequent letters in the alphabet.

  • MinimumLength (double): The minimum length for iterator variable names, the name should be descriptive. The default value for this parameter is 3 and it can be changed to anywhere between 1 and 20.

  • UseVariableCasing (boolean): Set to true to use the Casing parameter from checkVariableCasing to verify the correct casing of the iterator variable. If checkVariableCasing is not configured in the same configuration file, UseVariableCasing defaults to false.

By maintaining a convention on iterator variables, these can easily be distinguished.

Exemption tag: %@ok<IDXNA>