rspec/rules/S3255/rule.adoc

36 lines
525 B
Plaintext
Raw Normal View History

== Why is this an issue?
The use of the ``++this++`` keyword is only required when the member is shadowed by a local parameter, or variable. In other cases, the code should be simplified by its removal.
=== Noncompliant code example
2022-02-04 17:28:24 +01:00
[source,text]
----
public class MyClass
{
private int count;
public void DoSomething() {
this.count++; // Noncompliant
}
}
----
=== Compliant solution
2022-02-04 17:28:24 +01:00
[source,text]
----
public class MyClass
{
private int count;
public void DoSomething() {
count++;
}
}
----