rspec/rules/S122/swift/rule.adoc

38 lines
752 B
Plaintext
Raw Normal View History

2020-06-30 10:16:44 +02:00
include::../description.adoc[]
== Noncompliant Code Example
----
if someCondition { doSomething()}
...
var result = doSomething(); return result
----
== Compliant Solution
----
if someCondition {
doSomething()
}
...
var result = doSomething()
return result
----
== Exceptions
Variable declaration with initialising code block and closure expressions containing a single statement are ignored.
2021-02-02 15:02:10 +01:00
2020-06-30 10:16:44 +02:00
----
var x : Int { return 0 } // Variable declaration with initialising code block
doSomething({ (x: Int, y: Int) -> Bool in return x > y }, 5) // Closure expression
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::rspecator-view[]