rspec/rules/S122/swift/rule.adoc

40 lines
730 B
Plaintext
Raw Normal View History

2023-06-16 15:38:45 +02:00
:noncompliant: swift/noncompliant.adoc
:compliant: swift/compliant.adoc
2020-06-30 10:16:44 +02:00
include::../description.adoc[]
2023-06-16 15:38:45 +02:00
=== Exceptions
2020-06-30 10:16:44 +02:00
2023-06-16 15:38:45 +02:00
The rule ignores:
2020-06-30 10:16:44 +02:00
2023-06-16 15:38:45 +02:00
* variable declarations initialized with a code block
2020-06-30 10:16:44 +02:00
2022-02-04 17:28:24 +01:00
[source,swift]
2020-06-30 10:16:44 +02:00
----
2023-06-16 15:38:45 +02:00
var x : Int { return 0 } // Compliant by exception
2020-06-30 10:16:44 +02:00
----
2023-06-16 15:38:45 +02:00
* closure expressions containing a single statement
2021-02-02 15:02:10 +01:00
[source,swift]
2020-06-30 10:16:44 +02:00
----
2023-06-16 15:38:45 +02:00
doSomething({ (x: Int, y: Int) -> Bool in return x > y }, 5) // Compliant by exception
2020-06-30 10:16:44 +02:00
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]