Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a TFS Check in Policy that auto formats code for you?

Tags:

c#

tfs

Maybe what I'm looking for doesn't exist, but I've heard rumors that in TFS you can setup some way of auto formatting/Stylizing source code on check ins. So far in the research I've done it looks like the "Check in Policy" just sends alerts if your check in is flagged... Is there some way that the code can be auto-formatted upon check in or is this just wishful thinking? Could you please provide/link to examples.

like image 770
Grim Coder Avatar asked Jan 07 '15 18:01

Grim Coder


1 Answers

In my team, we have implemented a Check-in Policy that execute AStyle.exe on all code before check in, You can download AStyle from sourceforge. Yes, we are some that like all the code in the projects to have the same formatting and style, and yes it is easy to do with shortcuts in VS. The benefit of doing the styling before check-in is that when you are comparing versions of the same file, the format hasn't changed depending on developer that did the check-in.

like image 55
GrumpyBusted Avatar answered Oct 16 '22 22:10

GrumpyBusted