DEV Community

Andrzej Karaś
Andrzej Karaś

Posted on • Originally published at karas.codes on

Improve your work by usage of custom TODO labels

For sure, you have thousands of TODOs left in your project. Today I will show you how to sort them out a little.

TODOs and why we need them?

Every popular IDE as e.g. IntelliJ or Eclipse allows us to create comments containing magic TODO or FIXME labels. All comments marked like this could be found in a special section in our IDE.

Of course, they are used for marking some parts of code for the future when we want to: add some features, do some improvements, or fix some small bug that could wait for now.

This small feature helps us save time when working on something important - we don't have to open our task management tools to note it :)

Custom labels

I know those two labels could be enough, but as always we could distinguish a couple more of them. But ...

How we could create a custom label?

To prepare an example I will use IntelliJ IDE but, you could apply the same patterns to other IDEs.

You need to visit Setting -> Editor -> TODO and just add a custom pattern e.g. \bimprove\b.*. After that, your IDE would be highlighting your custom labels as default ones.

Scenario 1: Across columns

Why should I create a custom TODO label?

I will give you a couple of ideas on how to use custom labels:

  • IMPROVE - To distinguish things that must be fixed or just should be done later.By using a such label we could mark some nice-to-have changes
  • QUESTION - We could use them to give some open questions about the code before pushing it to code review. I know we could use e.g. Gitlab UI to do it. But doing it in the code will help us save time and will leave some notes way closer to the code - for sure not all team members will look at the issue you create.
  • OPTIMIZE - Special label for those who love doing performance optimizations in the code
  • SECURITY - Found some security flaw, but don't know how to fix it properly? You could mark that part of the code and share it with team members.

Let me know what other labels you will create in your project!

Top comments (0)