Statement follows an unconditional return or throw
ID |
scala.correctness.unreachable_code |
Severity |
low |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Dead Code |
Language |
Scala |
Description
This statement follows an unconditional return or throw, so it can never execute. Remove it, or move it above the exit if it was meant to run.
Rationale
This statement follows an unconditional return or throw, so it can never execute. Remove it, or move it above the exit if it was meant to run.
The following code illustrates the pattern detected by this rule:
class Unreachable {
def afterReturn(x: Int): Int = {
// FLAGGED: Statement follows an unconditional return or throw
return x
println("never runs")
x + 1
}
}
Remediation
Follow secure coding practices and review the references below for detailed remediation guidance.