Click or drag to resize

Team Foundation Server Check-in Policies

SQL Enlight provides a Static Code Analysis Check-in policy, which can be used to control and improve the quality of SQL code that is checked into the code base.

This topic contains the following sections:

Install and Configure
Note Note

Team Foundation Server check-in policis are evaluated client-side and have to be installed separatelly on each developers' machine.

On the other hand, the configuration of a TFS checkin-policy can be configured only once as it is stored on the TFS server with the project's configuration.

The Static Code Analysis Check-in policy is installed and registered in Visual Studio during a tipical SQL Enlight installation, but can be removed from the installation using the Custom setup option.

To configure the SQL Enlight policy, do the following:

  1. Make sure SQL Enlight is installed on the machine where the policy is being configured.
  2. Start Visual Studio 2008/2010/2012/2013/2015 and from the main menu select View->Team Explorer.
  3. Select project in Team Explorer and select from project’s context menu Team Project Setting->Source Control.
  4. Go to the Check-in Policy tab and add the SQL Enlight Code Analysis Policy.

    policy-5

  5. If SQL Enlight is successfully added, the Policy Settings form should appear.Edit button of the Source Control Settings dialog can also be used to bring Policy Settings form.

    policy-1

  6. Browse and select existing analysis template.
  7. The analysis template will be loaded and its rules will appear in the Analysis Rules list.

  8. Select rules which to be used by the policy. Optionally rule parameters can be show and configured by using the Show Details button.

    Later the selected rules can be modified by using the Edit button of the Source Control Settings dialog.

  9. Close the Policy Settings form.

The policy is now configured.

Applying Policy

The configured policy will be activated when any .sql files are being checked-in.

When the policy is activated, a progress window showing the status of the analysis will appear.

If any policy violations are found, they will appear in the Policy Warnings tab.

policy-4

Double clicking a warning will open the file at the line of the rule violation.