2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2021-06-08 14:23:48 +02:00
|
|
|
Names should be self-descriptive and this can't be the case when they are made of less than 3 characters.
|
|
|
|
|
|
|
|
Two-letter English words such as "is", "as", "of", etc. are allowed.
|
|
|
|
|
|
|
|
|
|
|
|
Local variables are not verified by this rule.
|
|
|
|
|
|
|
|
|
|
|
|
The following code snippet illustrates this rule:
|
|
|
|
|
|
|
|
|
|
|
|
----
|
|
|
|
public class A { // Non-Compliant
|
|
|
|
|
|
|
|
public int convert(String a) { // Non-Compliant
|
|
|
|
for (int i = 0; i < 42 ; i++) { // Compliant - local variable
|
|
|
|
/* ... */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void a() { // Non-Compliant
|
|
|
|
int i = 0; // Compliant - local variable
|
|
|
|
try {
|
|
|
|
/* ... */
|
|
|
|
} catch (Exception e) { // Compliant - local variable
|
|
|
|
/* ... */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private boolean is(Object a) { // Compliant - two-letter English word
|
|
|
|
/* ... */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
|
2022-01-25 18:36:46 +01:00
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
|
|
|
|
'''
|
|
|
|
== Comments And Links
|
|
|
|
(visible only on this page)
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== on 1 Aug 2013, 12:50:19 Freddy Mallet wrote:
|
|
|
|
Is implemented by \http://jira.codehaus.org/browse/SONARJAVA-262
|
|
|
|
|
|
|
|
=== on 20 Aug 2013, 11:38:45 Freddy Mallet wrote:
|
|
|
|
This rule generates too many false-positives
|
|
|
|
|
2022-01-25 18:36:46 +01:00
|
|
|
|
|
|
|
endif::env-github,rspecator-view[]
|