7 ms·
One of my favorite small linters I made on a previous team: // todo 2022-06-09 something ^ on that date, it'd fail the linter, and print the comment. Every
by Groxx 4y ago
One of my favorite small linters I made on a previous team:
// todo 2022-06-09 something
^ on that date, it'd fail the linter, and print the comment. Every TODO needed a date.
Got a failure and need to get past it for now? No problem: bump the date for a week or something. Now at least two people are aware that it exists (author+reviewer)... and one is in the git history for that line. Makes it rather easy to trace back who wrote a TODO / who put it off / etc. Though we fairly quickly started adding usernames to the comments for who-to-contact.
Sometimes they're just stuff to do "soon", sometimes they're no longer necessary, there are lot of reasons to delay or delete todos. But oh boy did it work. We resolved or removed about 90% of them in 2 months, and the remaining ones quickly got tasks attached and had bigger plans built around them.
- suby 4y agoI'm going to give this a try. Thanks for throwing the idea out there!
- Groxx 4y agoWe did eventually add a way to skip it outright per commit fwiw, to avoid merge conflicts when there were a lot of changes flying simultaneously. That may be worth planning on to some degree :) or show a warning if it's within a week or something. I'll also recommend generally treating it lightheartedly - the person who it interrupts is not usually the person best suited for tackling it. A no-questions-asked "you can always push the date off a bit" policy helped - poke the author of the cryptic comment so they know, and that's the end of the immediate responsibility. Target just enough friction and shared face-palming at forgetting so you don't ignore it outright, like often happens with merely printed lints, but if it becomes annoying it'll be avoided and then it's just yet another Jira competitor.
- giancarlostoro 4y agoHow do I get such a linter into Visual Studio, I've never added anything like that to C#, my personal strategy is to just make tickets, but also with stuff like JetBrains different IDEs you can fetch all the TODO's in a list. I opt for tickets so they dont get lost.
- briHass 4y agoVS automatically creates a To Do list window with all your TODO and similar comments. If you don't want to go as far as making it a git hook or built into your CI, you can use something like this: https://marketplace.visualstudio.com/items?itemName=MattLaceyLtd.WarnAboutTODOs https://marketplace.visualstudio.com/items?itemName=MattLace...
- agumonkey 4y agonice trick, placing scheduling in code seems interesting
- yakshaving_jgt 4y agoI had a similar idea a few years ago, but with a git hook. https://jezenthomas.com/using-git-to-manage-todos/ https://jezenthomas.com/using-git-to-manage-todos/
- Groxx 4y agoYeah, a lightly-annoying-when-passed hook would probably be a better fit for smaller environments / personal use. I may have to set that up for my own stuff, thanks! I set mine up in our CI environment because it was essentially trivial to do so, and it also caught people who didn't have hooks installed... but that's only really relevant because we had a couple dozen engineers rotating between many other projects that religiously avoid hooks. It was far too likely to be forgotten unless it was automated.
- shikoba 4y ago> Every TODO needed a date A todo is a todo. I don't see why a date is necessary.
- Groxx 4y agoIt was just to ensure it wasn't forgotten. If it's "long term", stick it for a year out or something, it's fine. Truly timeless? Year 2999 works pretty well, or just don't use "todo" because it apparently isn't gonna happen. We fairly often used it for stuff like "X should be upgraded to fix Y by now, see if this hack is still necessary". If was not, just push it out and check again then. Or do whatever else might be necessary since it didn't meet expectations. I've encountered many codebases with todos that are years old, sometimes authored by people no longer at the company. A date ensures these aren't lost forever. You can always just push it another year out.
- shikoba 4y agoYou can grep for todo in your codebase. It will list them.
- arinlen 4y ago> It was just to ensure it wasn't forgotten. Why don't you just add a ticket in a ticket backlog, then?
- ParetoOptimal 4y agoMost of the time it's not possible to trust items you add to the backlog related to tech debt will actually get done. Why make lists that will never be completed? Or put another way, there is no pain that can't be avoided by ignoring the backlog. You can only ignore these TODOs until your build fails, then you have to reflect on whether to do them, push them into the future, or delete them. I think this works because it really makes backlog grooming a group activity where everyone is involved, so everyone feels they have a say in setting priority.
- marcosdumay 4y ago
- vages 4y agoMy team also dates its todo items by the date of creation. I have played with the idea of failing building or linting after a specific date, but I have said no. I want to be able to check out a specific commit and have the same experience as when the commit was created. Having the linter fail based on the current computer clock setting would make that impossible.
- Groxx 4y agoDefinitely agreed, don't tie linting like this to your build system. It'll also suck if it blocks fixing an urgent problem.
- singularity2001 4y agoisn't tracking date and username provided by git (blame)?
- Groxx 4y agoThe authoring date is, yes. But not the "remind me at" date. As for author: yes definitely. And it's a great fallback option. But it's not visible in most code review UIs, and even when it is it tends to be the most recent editor, not the author. Git's CLI makes the full history of a line pretty easy to read with -L (usually, depending on if it detects a move or not), but have you ever tried to do that on GitHub? Back through several versions? It's a freaking nightmare, and nobody will try to do that while reading a diff.
- arinlen 4y ago> Got a failure and need to get past it for now? No problem: bump the date for a week or something. Now at least two people are aware that it exists (author+reviewer)... and one is in the git history for that line. That sounds like an awful strategy, one that needlessly creates problems and revision history noise and team distractions. Is it awful if a comment leads your CICD pipeline to break? Now imagine having your CICD pipeline break because of a TODO item. Just create a ticket in your ticket queue and get rid of that TODO.
- bottled_poe 4y agoYou could have the best of both worlds by making the CI job search the backlog for overdue critical tasks.
- srer 4y agoI do that, create the ticket. I want to believe it means one day we will do that TODO, it'll beat the priority of all the other tickets in the queue. But it never does, there's always some critical new feature sales wants, or something bigger on fire. I still create the tickets, as a kind of cathartic process, a confession to the jira gods, I have sinned and half assed something. Please take this ticket as my penance.
- actionfromafar 4y agoIn Eastern Liturgy, the ticket is the confession and the mandated overtime is the penance.
- KronisLV 4y ago> But it never does, there's always some critical new feature sales wants, or something bigger on fire. Then clearly it is not deserving of your attention according to the powers that be. If it is, then talk in the language that these parties understand better/prefer: bump up the priority of the task, add a "blocked by" or "has to be done after" link to these other issues in the tracker and tell the rest of the teammates that you'll be working on that piece of technical debt instead of the new feature. If you can't do that, then either the "TODO" comments/issues aren't important enough, or they're not deemed to be and will/should simply be left to rot until you either have an abundance of time to address them (which may be never), or the project is retired. If more pushback is necessary, then do it doing any estimates (provided that you have any): "Task $FOO will take X% more time due to $BAR not being finished and slowing down development. Consider doing $BAR first and $FOO should become less complex then."
- jillesvangurp 4y agoIt would be a cool little side project to automatically track TODO's and FIXMEs with an issue tracker. There is a lot of monkey work involved with issue tracking currently and a lot of work that isn't tracked or poorly tracked because of it. Lowering the barrier to make work and tasks more visible is useful.
- FooBarBizBazz 4y agoJira creates so much friction. It's a trillion dollar drag on the Tech industry. It should be as quick as writing a Slack message.
- quickthrower2 4y agoEven better: do it now, or not at all. If it is a failing test do it now anyway. The reason is the person adding the TODO may have a bias that their thing really is the most important tech debt. However I would step back and figure out what tech debt payback offers the best ROI with the team. If you have a pet hate refactor you want done, add it to a personal list and bring it up for consideration in that process. Or just fix it as part of your task if practical to do so.
- planede 4y agoI don't get why so many people likes this. No, I don't want a suddenly failing pipeline on master because of an expiring TODO. A better approach is for a TODO to be required to reference a ticket, and add a ticket. Prioritization should happen in your issue tracking, not in the code.
- ParetoOptimal 4y agoBecause the annoyance means it will get fixed? In issue tracking it just gets archived.
- planede 4y agoIf you want to set it a date, then set a deadline for the issue. It should still annoy the right person.
- arinlen 4y ago> Because the annoyance means it will get fixed? In issue tracking it just gets archived. That makes no sense at all. If a ticket is archived them that means the issue was evaluated and considered irrelevant and a distraction that should be ignored. Otherwise in the very least it should be placed on a backlog, and reconsidered each and every single time someone picks/is assigned a new task. Nagging through out-of-band means to push an irrelevant task that was already considered and discarded makes all matters worse, and frankly sounds like a playground for petty passive-aggressive office politics.
- jandrewrogers 4y agoMany TODOs (the majority in code bases I've worked on that had them) do not require any action, they are annotations to the code base about future potential development or research. Addressing the TODO, either by removal or implementation, could be deferred indefinitely with no consequences and often are. These aren't things that need to be fixed per se. For example, I've seen TODOs widely used to document optimization or generalization opportunities in the code base. You do not want to pollute your ticketing system with myriad TODOs. They are not meaningfully actionable and they tend to require very local code context so it is easier to understand them as code annotations.