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:
Team Foundation Server check-in policies are evaluated client-side and have to be installed separately on each developers' machine.
On the other hand, the configuration of a TFS check-in 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 typical SQL Enlight installation, but can be removed from the installation using the Custom setup option.
To configure the SQL Enlight policy, do the following:
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.
Optionally configure Include and Exclude regular expression patterns for the policy target files.
If an Include pattern is provided, the code analysis policy is applied only on the files, which match the pattern, otherwise all SQL files are included.
If an Exclude pattern is provided, all the code analysis policy target files, which match the pattern are ignored.
More than one regular expression patterns can be provided on separate lines. When the pattern is applied, the absolute path of each SQL file under the root source folder is tested.
For example, both regular expressions will match all SQL files under "SQL Scripts" folder:
The policy is now configured.
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.
Double clicking a warning will open the file at the line of the rule violation.