Php Chinese network (www.php.cn) provides the most comprehensive basic tutorial on programming technology, introducing HTML, CSS, Javascript, Python, Java, Ruby, C, PHP, basic knowledge of MySQL and other programming languages. At the same time, this site also provides a large number of online instances, through which you can better learn programming... 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: