rspec/rules/S800/rule.adoc

42 lines
1000 B
Plaintext
Raw Normal View History

Ideally, identifiers (names of classes, variables, methods, structures, macros, labeles, &etc.) are all easily distinguished from one another. Unfortunately, some characters or combinations of characters look enough alike that that's not always the case.
2021-02-02 15:02:10 +01:00
Therefore, identifiers that differ from each other only by one of these problematic characters (or character combinations) should be renamed.
2021-02-02 15:02:10 +01:00
The problem pairs are:
* capital 'O' and digit 0
* capital 'I' (eye) and digit 1
* capital 'I' (eye) and lowercase 'l' (el)
* lowercase 'l' (el) and digit 1
* capital 'S' and digit 5
* capital 'Z' and digit 2
* lowercase 'n' and lowercase 'h'
* capital 'B' and digit 8
* lowercase 'm' and the combination "rn" ('r' followed by 'n')
* any lowercase letter and its uppercase variant
* the presence or absence of an underscore
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,text]
----
int myl;
int myI;
int my1;
----
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,text]
----
int my_el;
int my_upper_i;
int my_one;
----