4 ms·
Whenever I used TODOs, they are documenting an unwanted behaviour in code that was forced by external circumstances: eg. the version of the OS doesn't support a
by redleader55 5y ago
Whenever I used TODOs, they are documenting an unwanted behaviour in code that was forced by external circumstances: eg. the version of the OS doesn't support a nice feature. In this case I will add a block beginning with "// TODO(redleader55) - 2021-09-06: remove the workaround and uncomment the code below when OS supports XXXX". You can configure a linter to complain about unowned TODOs, about not having a date or an issue number in the TODO.
There are several differences between a TODO in comments and a compile time check:
1. Such a linter would work for all possible languages with minimal changes - ie. adding the pattern for a comment.
2. You can choose to run the linter only for modified lines.
3. If you need, you can run and gather all TODOs in a project or across the whole codebase from time to time.
4. You can change the requirements - ie. adding an issue/task or the owner to the text of the TODO - without having to update all the old TODOs
5. It doesn't impact the compile time, since it is a comment