views:

74

answers:

3

I'm actually working on a tool that need some configuration before it can be used. To save some time a hard coded some values into the text boxes of the configuration tab, so I don't have to renter them every time I do some testing or debugging.

As we're using TFS to manage our solutions I'm wondering if there is a way to mark those hard coded elements in some way so that TFS or Visual Studio 2008 will remind me to remove/replace them before I do a check in.

UPDATE:

The todo comments won't be a real solution as we're already using it to mark code segments which have to be reworked. We use it as a reminder for longterm tasks. And we have plenty of them so this might become a little bit unclear.

A: 

You could write a unit test that fails when the hardcoded stuff is found. Obviously, you won't get a reminder before checking in but you do get a build failure afterwards.

grenade
+2  A: 

Probably not the perfect solution, but Visual Studio let's you add TODO comments that may work well enough for you.

RichardOD
The todo comments won't be a real solution as we're already using it to mark code segments which have to be reworked. We use it as a reminder for longterm tasks. And we have plenty of them so this might become a little bit unclear.
Flo
You can use a different tag than TODO. If you go to Options -> Environment -> Task List you can add new tags. One could be Pre-Build.
Ryan
@Ryan- that's a good suggestion. @Flo- I tend to use the ObsoleteAttribute a lot when reworking code- http://msdn.microsoft.com/en-us/library/system.obsoleteattribute.aspx
RichardOD
+3  A: 

Some options:

  1. write a custom checkin policy
  2. use the existing FxCop checkin policy and write a custom rule (if you're marking TODOs with something that gets actually compiled, like an Attribute)
  3. ditto, but via the StyleCop checkin policy (if your TODOs are source comments)
Richard Berg
+1 for using checkin policy
Vaccano