
When an include is not surrounded by empty lines, its content is inlined on the same line as the adjacent content. That can lead to broken tags and other display issues. This PR fixes all such includes and introduces a validation step that forbids introducing the same problem again.
56 lines
1.1 KiB
Plaintext
56 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
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
|
|
|
|
[source,swift]
|
|
----
|
|
func fun(p1:Int) {
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,swift]
|
|
----
|
|
func fun(p1:Int) {
|
|
var a = doSomething(p1)
|
|
var threshold = 42
|
|
if a > threshold {
|
|
// ...
|
|
}
|
|
}
|
|
----
|
|
or
|
|
|
|
[source,swift]
|
|
----
|
|
func fun(p1:Int) {
|
|
// Intentionally unimplemented...
|
|
}
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Add a nested comment explaining why this [function|closure] is empty, or complete the implementation.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|