Not Implemented Declaration
ID |
kotlin.not_implemented_declaration |
Severity |
high |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Reliability |
Language |
Kotlin |
Tags |
reliability, todo |
Description
Reports calls to TODO() in production source files.
Kotlin’s TODO() is a stdlib function that unconditionally throws
kotlin.NotImplementedError with the supplied message. Any code path that
reaches a TODO() call crashes at runtime, making it a hard reliability
defect when present in shipped code.
Rationale
// Bad — crashes at runtime on any invocation
fun processPayment(amount: Double): Receipt {
TODO("not yet implemented") // FLAW
}
// Bad — no-arg form is equally fatal
fun sendNotification() {
TODO() // FLAW
}
// Good — real implementation
fun processPayment(amount: Double): Receipt {
return paymentGateway.charge(amount)
}
Remediation
Replace every TODO() call with a real implementation before merging to a
production branch. If the feature is intentionally deferred, track it in the
issue tracker and guard the call site behind a feature flag so it is
unreachable in production builds.