How many TODO, do you have in your code? If your code base is big, or running for couple of years, I bet you have several dozen of TODOs in comments. And most likely, they are going to stay for a while.
Usually we write TODOs like this
// TODO: We need to refactor this part of code later when we have time
func myFunction() -> Bool {
return true
}
❌ TODOs got forgotten, unless you have a process to check them and search them once in a while
❌ We hardly know who did it and when
❌ Of course you can use git to track history (author + date) but if someone move the code away these data got lost and it’s hard to track bac
The good way
#warning("TODO: athomas, 2021-03-04: We need to refactor this part of code later when we have time.")
func myFunction() -> Bool {
return true
}
✅ Use the #warning command, which is then generating a warning at compile time. As the warning pops up on each compilation, it has more chances to be picked up.
✅ Keep the keyword “TODO” in our comment, so we can still use the Search feature of Xcode to look for all the TODOs.
✅ Indicate the author + date in the comment, so even after cut+paste , the information is going to stay.
Thank you for reading until here… 👊 Have a good week end… 🍺