31 lines
462 B
Plaintext
31 lines
462 B
Plaintext
In the interests of clean code, getters should be implicit, rather than explicit for properties that have only getters.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
var luckyNumber: Int {
|
|
get { // Noncompliant
|
|
return 7
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
var luckyNumber: Int {
|
|
return 7
|
|
}
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::comments-and-links.adoc[]
|
|
endif::env-github,rspecator-view[]
|