21 lines
379 B
Plaintext
Raw Normal View History

2020-06-30 12:48:39 +02:00
include::../description.adoc[]
== Noncompliant Code Example
----
function getReadableStatus(job) {
return job.isRunning() ? "Running" : job.hasErrors() ? "Failed" : "Succeeded "; // Noncompliant
2020-06-30 12:48:39 +02:00
}
----
== Compliant Solution
----
function getReadableStatus(job) {
if (job.isRunning()) {
return "Running";
2020-06-30 12:48:39 +02:00
}
return job.hasErrors() ? "Failed" : "Succeeded";
2020-06-30 12:48:39 +02:00
}
----