rspec/rules/S1223/rule.adoc

28 lines
524 B
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2020-06-30 12:47:33 +02:00
Having a class and some of its methods sharing the same name is misleading, and leaves others to wonder whether it was done that way on purpose, or was the methods supposed to be a constructor.
=== Noncompliant code example
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2020-06-30 12:47:33 +02:00
----
public class Foo {
public Foo() {...}
public void Foo(String label) {...} // Noncompliant
}
----
=== Compliant solution
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,text]
2020-06-30 12:47:33 +02:00
----
public class Foo {
public Foo() {...}
public void foo(String label) {...} // Compliant
}
----