rspec/rules/S1224/rule.adoc

26 lines
483 B
Plaintext
Raw Normal View History

Having a duplication between a field name and a method name is confusing, misleading, and probably an indication that the field name should be updated to be more meaningful.
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,text]
----
public class Foo {
public int sum; // Noncompliant, matching sum() method name
public int sum() {...}
}
----
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,text]
----
public class Foo {
public int sumTotal; // Compliant
public int sum() {...}
}
----