Analysis Settings

General Analysis Settings

This section contains the following subsections:

settings-analysis-general

Analysis Template Import/Export

Analysis template can be exported in an XML file and later imported on another machine or distributed between team members.

Using the following steps the analysis templates can be imported in SQL Enlight:

  1. Download the latest analysis template from our website.

  2. Start SQL Server Management Studio or
    Visual Studio, open SQL Enlight Options, and go to Settings -> Analysis Settings item

  3. Create a backup of your existing template using the Export button.

  4. Choose how the template will be imported:

    • Completely import and replace the active analysis template with the imported ones.

      To use this option, unselect the Update existing rules and groups check box.

    • Import all new rules and update existing rules from the new template, and preserve the rules in the active template that do not exist in the new template.
      This option is suitable for the case when you have custom rules (with names different than the ones in the new template) that you want to preserve.

      To use this option, make sure that the Update existing rules and groups check box is selected.

  5. Use the Import button to select the template file and import it in SQL Enlight.

Reset analysis template

The Reset button under the Export/Import section to reset the current analysis template to the default template.

There are three options for resetting the current template:

  • Standard rules only – Any changes to the standard rules are reset, but the custom rules are not removed.
  • Parameters only – only the parameters of the standard rules are reset to defaults.
  • All rules – Any changes to the standard rules are reset and all custom rules are removed.
Note Note

Create a backup of your existing template using, because all changes to the current template, any new rules or changes of existing rules will be lost.

Analysis template inheritance

The setting enables or disables analysis base template inheritance.

Enabling inheritance allows standard rules from the base analysis template to be updated automatically with the latest version when a new version of SQL Enlight is installed.

Disabling the inheritance can be useful in case you would want to use only a set of custom analysis rules.

The recommended setting for the inheritance is enabled.

Analysis Context Settings

This section contains the following subsections:

settings-analysis-context

Analysis Context Mode

Choose the detail level of the analysis context:

Basic

Basic mode will load only the most commonly used schema information such as:

  • Server Information
  • Principals, Role Members
  • Schemas
  • Data Types
  • Assemblies
  • Tables, Views, Triggers
  • Functions, Partition Functions, Stored Procedures
  • Rules,Defaults,Synonyms
  • XML Schema Collections
  • Indexes,Foreign Keys, Primary Keys, Check Constraints, Default Constraints
  • FullText Catalogs, Data Spaces, File Groups
  • Dependencies, Partition Schemes
  • Statistics
Full

The Full mode will load all the basic schema information and also some additional database objects:

  • Message Types
  • Service Contracts, Service Queues, Services, Service Bindings
  • Routes
  • SymmetricKeys
  • AsymmetricKeys, Certificates
  • Extended Properties, Event Notifications

Test Analysis Context Connection

The Test Analysis Context Connection specifies the default connection to be used for testing analysis rules and generating analysis context in the Analysis Rule Designer.

Note Note

The test connection string setting is now in the Known Connections list as ‘TestAnalysiContext’ entry.

Context not available warning

If the analysis context cannot be loaded or the SQL Connection to the context database cannot be established, the
analysis rules which require context will be disabled.

The setting controls whether a warning is to be reported for each analysis rule that is disabled because of the missing analysis context.

Analysis context cache

The setting specifies the location of the disk folder where database and server context information is stored. The disk cache is always enabled and is meant to speed up the loading of database context information.

The default folder is user’s application folder:

%APPDATA%YubitSoftSQL Enlight{version}Cache

The location can be changed in order to provide more or free disk space.

SSMS Analysis Settings

This section contains the following subsections:

settings-analysis-ssms

This settings tab contains SQL Server Management Studio specific integration related configuration options.

Instant Code Analysis

Instant Code Analysis enables SQL documents to be analyzed in the background using the rules in the current analysis template.

The analysis will be triggered a couple of seconds after a script document is opened for the first time or an opened document has its content changed.

  • Enable Instant Code Analysis

    Enables background analysis.

  • Maximum Script size

    The Maximum script size setting controls the maximum analyzable by the Instant Code Analysis feature, document size.

    Documents with content bigger than the specified limit will be ignored.

    Available values: 100 KB, 200 KB, 500 KB, 5 MB, or Unlimited

  • Delay

    The Delay setting specifies the wait between the last document change and the start of the code analysis. The default value of the delay is 4000 ms.

  • Disable Instant Code Analysis

    Disables background analysis.

Active code window connection context

Enable or disable loading of the connection context when analyzing statements in the active code window.

When connection context is disabled, SQL Enlight does not attempt to load database context information and works without it. This setting will affect any context analysis rules and any rules which use the context information, but might speed up analysis in case only T-SQL script is analyzed or in case the database connection is not currently available.

The recommended setting for this option is not checked ( the connection context is enabled).

Run analysis before executing SQL code

The setting can be used to prevent executing SQL code that has any analysis issues. The set of rules, which are applied can be configured to either all active analysis rules or all rules from a specified analysis group.

Other Settings

This section contains the following subsections:

settings-analysis-other

Syntax errors

The Disable syntax errors in analysis results setting control whether the syntax errors are reported in the analysis results or ignored.

SQL Server Script Validation Settings

Enable SQL script to be validated by the connected SQL Server instance before doing analysis.

When the setting is enabled, there are two options which are available:

  • Parse – The script is only parsed by the SQL Server and only syntax errors are reported.
  • Parse and Compile – The script is parsed and compiled and syntax and schema errors are reported.

SQLCMD mode support

Configure support for SQLCMD mode commands and variables. If enabled, the script is preprocessed and the SQLCMD variables are replaced before running code analysis.

Whitelist

Analysis Whitelist – configure databases and objects, which are to be excluded from the analysis results.

settings-analysis-whitelist

Using an empty string or a wildcard ‘*’ value of the text properties will match everything for that particular property. The object properties support also regular expressions.

Whitelist properties:

  • Schema – A regular expression that matches the object’s schema name
  • Rules – A comma separated list of rule names for which to remove their matched results
  • Server Instance – server instance for which to remove the matched by the whitelist entry results
  • Database– database for which to remove the matched by the whitelist entry results
  • Enabled – only the enabled whitelist entries are considered
  • Name – A regular expression that matches the object’s name
Known Connections

The Known Connections stores a list of connection strings for commonly used databases. These connection strings will be used by SQL Enlight for loading the database’s metadata instead of the active connection from the IDE.

settings-analysis-known-connections

The main use case for this setting is to make SQL Enlight use different connection settings when loading database metadata. For example, when the user connects to a database from SSMS with an account having limited SQL Server privileges, but to be able to load all the metadata because SQL Enlight needs administrator privileges, a new connection string with SQL Authentication and administrator user can be configured for the particular database.

Properties:

  • Name – the informational name of the connection.
  • Database – the target database. The field is readonly and is retrieved from the connection string.
  • Server – the target server instance. The field is readonly and is retrieved from the connection string.
  • Connection String – The connection string. The field is shown only when it is not secured.
  • Secured – When the field is secured, it is stored encrypted in the SQL Enlight settings and cannot be edited after it is saved.
  • Enabled – Enable or disable the current entry.
Cache

This section contains the following subsections:

settings-analysis-cache

Disk cache

The setting specifies the location of the disk folder where database and server context information is stored. The disk cache is always enabled and is meant to speed up the loading of database context information.

The default folder is user’s application folder:

%APPDATA%YubitSoftSQL Enlight{version}Cache

The location can be changed in order to provide more or free disk space.

In-memory cache

The setting configures the sliding timeout for in-memory cached server and database data.