Charlie Mott

  Home  |   Contact  |   Syndication    |   Login
  20 Posts | 0 Stories | 20 Comments | 0 Trackbacks


View Charlie Mott's profile on LinkedIn


Tuesday, November 22, 2011 #

Article Source:

TODO's in code should only be used for a short period of time to remind you that something needs to be done. They should be addressed as soon as possible.

In order to know who owns a TODO task and how long it’s been outstanding, my company uses the following formatting standard:

Format:     // TODO : Owner Initials – Date Created – Description of task.

Sample:     // TODO : CM – 2011\11\22 – Move this class to a reusable location.

Using this pattern makes it easier to find and review items in the Visual Studio Task List or the Resharper TODO explorer.

The Carrot

In order to make it easy for developers to apply this rule, create a Visual Studio code snippet or Resharper template. Using the Resharper template facility provides macros for the current user name and the current date. Below is a C# template.  You could also make similar snippets\templates for other languages.


This actually makes the formatting use the logged in username rather than initials.  Ideally, I would have preferred to use the account logged into TFS.

Sample:     // TODO : cmott – 2011\11\22 – Move this class to a reusable location.

The Stick

How do you enforce such a rule? I have created a custom StyleCop rule. I followed the approach provided by the StyleCop Contrib project. This has a simple base class and easy to use unit testing framework. I have uploaded this TODO analyzer as patch 10902 to that project.