rspec/rules/S2962/swift/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
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.
2023-05-25 14:18:12 +02:00

51 lines
719 B
Plaintext

== Why is this an issue?
For read-only computed properties and subscript declarations, the ``++get++`` keyword and its braces are optional, and should be omitted for the sake of brevity.
=== Noncompliant code example
[source,swift]
----
struct Magic {
var number:Int {
get { // Noncompliant
return 42
}
}
}
----
=== Compliant solution
[source,swift]
----
struct Magic {
var number:Int {
return 42
}
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove the "get" keyword and its braces.
'''
== Comments And Links
(visible only on this page)
=== is duplicated by: S3668
endif::env-github,rspecator-view[]