Patterns / TODO stubs and unimplemented functions
TODO stubs and unimplemented functions
When a task gets long, agents stub the hard part and keep going. The PR passes type checks and maybe tests, the summary says 'implemented X', and one code path throws the first time it runs.
What it looks like
// TODO: implement email sending
throw new Error("Not implemented")
raise NotImplementedError
todo!()
def handle(): pass
Why it matters
Stubs are invisible in a PR summary and easy to miss in a long diff.
Before and after
Before
export async function sendInvoiceEmail(id) {
// TODO: implement email sending
throw new Error("Not implemented");
}After
export async function sendInvoiceEmail(id) {
const invoice = await getInvoice(id);
await mailer.send({ to: invoice.email, template: "invoice", data: invoice });
}How to fix it
- Finish the function, or don't merge it.
- If it really must wait, track it: TODO(#123) or TODO(JIRA-45). SlopScore for Code doesn't flag TODOs with an issue reference.
- Abstract methods and Protocol stubs are fine; they're skipped.
When it's fine
Tracked TODOs, abstract base classes, and interface stubs.
Catch this automatically. SlopScore for Code checks every pull request for this pattern (rule
todo-stub) and 11 others. Score a public PR or add the free GitHub Action.