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
(lower/upper Camel casing),
i_row
, j_test
(Snake casing), iROW
, jTEST
(screaming Snake
casing) or or irow, jtest
(lower casing). 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/screaming Snake casing), a lower case character (lower casing) or an underscore followed by a lower case character (Snake casing).
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 1 to use the casing parameters for variable casing. If set to 0, iterator variable names can be of the forms lower/upper Camel casing, Snake casing, screaming Snake casing or lower casing.
By maintaining a convention on iterator variables, these can easily be distinguished within the code.
Exemption tag: %@ok<IDXNA>