0 reply content:
When working on a project, it's often needed to create a list of tasks for yourself or your team mates. While usually these tasks are described in an issue tracker like YouTrack
, Some tasks are either too small or too code-specific to describe in an issue tracker. In such a case, adding TODO comments in source code makes sense.
Specifically, when you are writing code, you suddenly realize that your previous Code has a potential small bug, but it is not important. The common practice is:
- Fix the bug immediately. Then, when you return to your current job, your thinking will be interrupted.
- Keep the bug in your mind and continue to write your code. Soon you forget this bug.
- Make a comment on the bug and continue writing the code. Soon you forget this bug. A long time later, you will find a comment when you flip the previous code.
- ......
The wise practice is:
Write
"# Todo: computer will explode while running the program for 24 + hours"And continue to write the code.
To prevent you from forgetting this bug in the future, pycharm will prompt you in three places:
In addition, todo can also be used to differentiate between projects with multiple users.
"Who is going to fix this bug". PyCharm official documentation
Introduction:
Create several filters, which you will use to show the TODO items, say, for each of the developers, and not for your good self. for this purpose, in the Filters section, click, and specify the filter names, for example, For John, For Bob, and not for me. associate these filters with the patterns:
Now, in the source code, create TODO items: in the line of code, where you want to add a note, press Ctrl + Slash, or Ctrl + Shift + Slash, and type TODO that matches one of the patterns, followed by some meaningful description: