rspec/rules/S3358/swift/rule.adoc

33 lines
617 B
Plaintext

include::../description.adoc[]
== Noncompliant Code Example
----
func getReadableStatus(job: Job) -> String {
return job.isRunning ? "Running" : job.hasErrors ? "Failed" : "Succeeded"; // Noncompliant
}
----
== Compliant Solution
----
func getReadableStatus(job: Job) -> String {
let status: String;
if (job.isRunning) {
status = "Running";
}
else {
status = job.hasErrors ? "Failed" : "Succeeded";
}
return status;
}
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]