
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
39 lines
664 B
Plaintext
39 lines
664 B
Plaintext
== Why is this an issue?
|
|
|
|
In the interests of clean code, getters should be implicit, rather than explicit for properties that have only getters.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,swift]
|
|
----
|
|
var luckyNumber: Int {
|
|
get { // Noncompliant
|
|
return 7
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,swift]
|
|
----
|
|
var luckyNumber: Int {
|
|
return 7
|
|
}
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== duplicates: S2962
|
|
|
|
=== on 8 Jul 2016, 19:29:50 Ann Campbell wrote:
|
|
https://github.com/github/swift-style-guide#prefer-implicit-getters-on-read-only-properties-and-subscripts
|
|
|
|
endif::env-github,rspecator-view[]
|