rspec/rules/S1117/java/rule.adoc

24 lines
663 B
Plaintext
Raw Normal View History

:message: Rename "${elementName}" which (hides|has the same name as) the field declared at line {}.
include::../why.adoc[]
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,java]
2020-06-30 12:47:33 +02:00
----
class Foo {
public int myField;
public void doSomething() {
int myField = 0; // Noncompliant
2020-06-30 12:47:33 +02:00
...
}
}
----
== Resources
=== Documentation
* https://wiki.sei.cmu.edu/confluence/display/c/DCL01-C.+Do+not+reuse+variable+names+in+subscopes[CERT, DCL01-C.] - Do not reuse variable names in subscopes
* https://wiki.sei.cmu.edu/confluence/display/java/DCL51-J.+Do+not+shadow+or+obscure+identifiers+in+subscopes[CERT, DCL51-J.] - Do not shadow or obscure identifiers in subscopes
include::../rspecator.adoc[]