tags:

views:

68

answers:

3
+1  Q: 

TFS Check in rules

Hi I'm out of setting up an TFS server and I want to set some check-in rules.

I for example want to be able to set rules about method lenght, complexity and so on, I found NDepend very convenient can I somehow use NDepend to run some rules on the files trying to check in.

I also want to be able to bypass the rules sometimes.

Are there any blogs or discussions around this, if it wont work with NDepend are there any other tools or ways I can use?

A: 

Check this page. It has quite a few check-in policy packs which might help you out.

Here is another one.

danish
Well I have seen them, and I'm not impressed. I think there are no customization about how long methods should be. I have to adjust to like the Code Analysis metrics :(.
NPehrsson
A: 

See this page. It tells step by step way to create a custom policy.

danish
+1  A: 

I would be very careful about this. I worked at a place once that had strict method length rules. If Calculate(a,b,c) ended up 1.5 times the limit length, the devs would just move the last third of the function into Calculate2() and call it from Calculate(). All the active locals would become parameters, of course - sometimes there would be a dozen of them. The resulting mess passed the automated tests for method length but were definitely not better or more maintainable than the long methods would have been.

Would it have been nice if the devs had spotted something refactorable in the middle of the method, pulled it out and given it a good name? Yes it would. But systems are all game-able, and the sorts of "dammit I just want to check in and go home" changes that are made to comply with method length rules (among others) make the code worse. A lot worse.

Also to bypass the rules there's a way on the checkin to say you are bypassing and why.

Kate Gregory