DEV Community

loading...

Discussion on: How do you keep track of notes in code?

Collapse
bpedroza profile image
Bryan

I absolutely loathe seeing TODO in any comments in code. If you know you need to do something, just do it. IMO, these can be tracked with source control. If I see a TODO comment in the PR, it's not getting merged in. Open an issue if you're not going to do it now so others can track it, or tackle it.

Sorry, I know this probably isn't the kind of feedback you're looking for, but it's how I feel about it.

Collapse
dansilcox profile image
Dan Silcox

I even have a pre-commit git hook for this - well, to be fair, I allow the TODO to exist as long as there's an issue reference to go with it :D

Collapse
bpedroza profile image
Bryan

That's an interesting idea. I'd be curious to see what that looks like if you're able to share.

Collapse
1e4_ profile image
Ian

If your working on something else or it's end of day on your own branch it makes sense to use @todo with a comment. I agree however there should not be any @todo in any branch in production

Collapse
bpedroza profile image
Bryan

Yeah, totally agree.

Collapse
madza profile image
Madza Author

I see where you are coming from 😉 For collaboration oriented projects I prefer using the issues panel too, for personal projects I like to make notes directly in code. Nothing will be deployed to production, while there are still to-dos left, I just find this approach more productive as I don't have to switch between any notes app 😉

Collapse
bpedroza profile image
Bryan

I can see that use case. I know some people have pointed to IDE extensions to track these. I think a clearer way to do this while in development is just to write a failing test. Example in php:

public function test_can_upload_file()
{
    $this->fail('Upload file functionality needs to be implemented.');
}
Enter fullscreen mode Exit fullscreen mode

This way it's clear something is not done when running your test suite and you don't have to change your development practices to go hunting for them. Run the test suite -> see tests are failing -> there are things to do.

As with anything in programming though, that's just my opinion 😄

Thread Thread
madza profile image
Madza Author

from the programming view, this is absolutely correct and should be considered as a best practice 😉 i know it's just me, usually being too lazy to write failing tests, when you could do just Ctrl + / 😂😂