This project is read-only.

Use Check-in Policies to Enforce Coding Standards

- J.D. Meier, Jason Taylor, Alex Mackman, Prashant Bansode

Use check-in policies to enforce coding standards across your development team. Check-in policies help to ensure that all source code checked into TFS source control meets your defined coding standards.

The code analysis check-in policies that ship with TFS enables you to ensure that static code analysis has been run on code before it is checked in. You can fine-tune the code analysis policy to check many different rules. For example, you can check rules governing design, interoperability, maintainability, mobility, naming conventions, reliability, and more.

To enforce a code analysis check-in policy for a team project
  1. In Team Explorer, right-click your team project, point to Team Project Settings, and then click Source Control.
  2. Click the Check-in Policy tab and then click Add.
  3. In the Add Check-in Policy dialog box, select Code Analysis and then click OK.
  4. In the Code Analysis Policy Editor, select either Enforce C/C++ Code Analysis (/analyze) or Enforce Code Analysis For Managed Code. Select both if your project contains a combination of managed and unmanaged code.
  5. If you select Enforce Code Analysis For Managed Code, configure your required rule settings for managed code analysis based on your required coding standards. This determines precisely which rules are enforced.

You can also create a custom check-in policy to perform checks that are not available by default. For example, you can disallow code patterns such as banned application programming interface (API) calls, or you can write a policy to enforce your team’s specific coding style guidelines, such as where braces should be positioned within your source code.

Additional Resources

Last edited Jul 26, 2007 at 10:47 AM by prashantbansode, version 4


No comments yet.