rspec/rules/S1186/swift/rule.adoc

47 lines
922 B
Plaintext

There are several reasons for a function or closure not to have a body:
* It is an unintentional omission, and should be fixed to prevent unexpected behavior in production.
* It is not yet, or never will be, supported. In this case an exception should be thrown.
* The function is an intentionally-blank override. In this case a nested comment should explain the reason for the blank override.
== Noncompliant Code Example
----
func fun(p1:Int) {
}
----
== Compliant Solution
----
func fun(p1:Int) {
var a = doSomething(p1)
var threshold = 42
if a > threshold {
// ...
}
}
----
or
----
func fun(p1:Int) {
// Intentionally unimplemented...
}
----
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[]