The set of analysis rules defined by SQL Enlight Code Quality are the same rules as in SQL Enlight except for the context analysis rules (these are rules that are applied only on database or server metadata).
The rules are defined in a new built-in Quality Profile for T-SQL, named SQL Enlight.
To activate, deactivate, and configure rules, a new non-built-in Quality Profile is needed, as the built-in profiles cannot be modified by the user.
The new profile can be created by copying the built-in profile:
The new profile inherits the rules from the built-in profile, but now the rules are configurable:
When in the new profile, the rules can be activated or deactivated, and parameters configured.
There are about 80 analysis rules defined by the plugin in SonarQube, which have configuration parameters. The configurable rules have the `configurable` tag and can be filtered using it.
While the activated configurable rules have default values, the configuration parameters of those rules also need examination because the default values may not always be optimal for the project, or they could also have some advanced features disabled for the general use.
Setting parameters of activated analysis rule can be done when opening a rule from the non-built-in profile and using the
Change button to edit the parameter values.
Consideration is needed for the inactive configurable analysis rules because those are disabled by default due to requiring some explicit configuration, usually specific to the project that is analyzed. For instance, such are the naming rules, which depend on the adopted naming convention. There are also metric rules (starting with SEM), which also can have configurable parameters. These rules are inactive by default because they are utilized internally only during the collection of metric data.
Setting parameters of inactive rules can be done before rule activation when a modal dialog allowing the change of the parameter values is open:
There is another set of rules that need a specific configuration. These are the rules that need metadata of the context database or SQL connection to be able to query some additional metadata. These rules are marked with `require-context` or `require-connection` tags. Even when these rules are active, but the connection and context file are not provided, the rules, are not used in the analysis.
The connection and context file can be configured in the plugin settings for a project. When a connection is present, it will be used by the plugin to generate analysis context metadata, and in this case, the context file setting can be ignored.