Question: I've worked on a couple of projects where we spent a great deal of time discussing and writing elaborate coding standards covering everything from syntax layout to actual best practices. However, I have also found that these are rarely followed to the full extent. Many developers seem to hesitate to reject a code review based on coding standard violations alone. I.e. violations are committed to the repository on a regular basis. 

My questions are: Do you have coding standards? What do they cover? Are they followed by everyone? And what do you do (if anything) to make sure everybody is following the standards?

I'm aware that there is a similar question [here](https://stackoverflow.com/questions/167575/should-a-project-manager-enforce-coding-standards), but my concern is not so much how you could do it, but how you are actually going about it and what are the perceived benefits?

Answer: 
Do you have coding standards?

> 
> 
> > 
> > Yes, differs from project to project.
> > 
> > 
> > 
> 
> 
> 

What does it cover?

> 
> 
> > 
> > Code(class, variable, method, constant), SQL naming and formatting convention
> > 
> > 
> > 
> 
> 
> 

Is it being followed by everyone?

> 
> 
> > 
> > Yes, every new entrant in project could be asked to create a demo project following organization coding convention then it gets reviewed. This exercise makes developer feel at ease before starting real job.
> > 
> > 
> > 
> 
> 
> 

And what do you do (if anything) to make sure everybody is following the standard? 

> 
> 
> > 
> > **Use StyleCop and FxCop** to ensure they are religiously followed. It would show up as **warning/error if code fails to comply** with organization coding convention.
> > 
> > 
> > **Visual Studio Team system** has **nice code anlysis and check-In policies** which would prevent developers checking in code that does not comply
> > 
> > 
> > 
> 
> 
> 

Hope, it helps

Thanks,
Maulik Modi
Oh yes, I'm the coding standard police :) I just wrote a simple script to periodically check and fix the code (my coding standard is [simple enough](https://stackoverflow.com/questions/276173/what-are-your-favorite-c-coding-style-idioms#276560) to implement that.) I hope people will get the message after seeing all these "coding convention cleanups" messages :)