
org.sonar.plugins.csharp.S3358.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonarlint-omnisharp-plugin Show documentation
Show all versions of sonarlint-omnisharp-plugin Show documentation
Code Analyzer based on Omnisharp
Why is this an issue?
Nested ternaries are hard to read and can make the order of operations complex to understand.
public string GetReadableStatus(Job j)
{
return j.IsRunning ? "Running" : j.HasErrors ? "Failed" : "Succeeded"; // Noncompliant
}
Instead, use another line to express the nested operation in a separate statement.
public string GetReadableStatus(Job j)
{
if (j.IsRunning)
{
return "Running";
}
return j.HasErrors ? "Failed" : "Succeeded";
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy