rspec/rules/S3111/swift/rule.adoc

29 lines
742 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
Conditional compilation is generally recognized as a bad practice that is occasionally necessary when dealing with platform-specific code. As much as possible, code should be refactored to minimize or eliminate conditionally-compiled, platform-specific code because even when necessary and well-intentioned, such code segments can leave your codebase in a hopeless tangle.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
#if os(OSX) // Noncompliant
let a = 2
#else
let a = 3
#endif
----
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[]