36 lines
968 B
Plaintext
36 lines
968 B
Plaintext
Looking at the set of methods in a ``++class++``, ``++struct++``, ``++enum++``, or ``++extension++`` and finding two methods that differ only by capitalization is confusing to users of the class. It is similarly confusing to have a method and a field or a case which differ only in capitalization.
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
class SomeClass {
|
|
var lookUp = false
|
|
func lookup(){ } // Noncompliant; method name differs from field name only by capitalization
|
|
func lookUP(){ } // Noncompliant; method name differs from field and another method name only by capitalization
|
|
}
|
|
----
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
class SomeClass {
|
|
var lookUp = false
|
|
func getLookUp(){ }
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|