Identifiers should not be composed of 'l' and 'O' characters only

# T010

# Identifiers should not be composed of 'l' and 'O' characters only

Description:

The characters 'l' (which is lowercase 'L') and 'O' (which is uppercase 'o') should not be the only characters used in the identifier, because this would make them visually similar to numeric literals.

Compliance: Inspirel

Show source code for this rule

Hide source code

    # Identifiers should not be composed of 'l' and 'O' characters only

    foreach file [getSourceFileNames] {
        foreach t [getTokens $file 1 0 -1 -1 {identifier}] {
            set value [lindex $t 0]
            if [regexp {^(l|O)+$} $value] {
                report $file [lindex $t 1] "identifier should not be composed of only 'l' and 'O'"
            }
        }
    }

Rule index