When issue is closed :
— it detects TODOs anywhere, not necessarily in comments, it could destroy some code (same for 'inject-issue' but here it would be a removal, can be tougher) — maybe a TODO previously related to this issue will have to be modified instead of deleted, how should it handle it?
When TODO is removed :
— should I close issue directly or check in the whole codebase if it still exists somewhere and keep it open?
Many questions arise and I still found no harmless answers :(
But it definitely should help you track it both ways, with a command "stat" for example that would report you any actions you should achieve, and even interactively do it for you. But I don't think it will happen in hook itself yet.
I want all ideas available here ;) should create an issue for open discussion.
I think that any automation should affect issues and not involve directly changing code. So, it might be interesting to have a toggle to automatically close issues after scanning the repo for the presence of TODOs. I do think that this should be a toggle that can be switched on or off.
Put some sort of tag in the todo comment to represent a change. e.g. // TODO: Fix this issue #complete
At commit time, the hook will see the tag changed, reference the commit in the issue, and then auto-close it.
Once question, once a TODO is removed from the repository, is the issue also automatically closed? Or vice-versa? Would be cool if the two were coupled, so that there aren't dangling TODOs left in the repository once the issue has been addressed in some fashion.