Ignoring rules and objects

Applies to
ApexSQL Enforce

Summary
This article describes how to ignore rules and objects in ApexSQL Enforce.

Description

In case the user wants to ignore results for the specific object (e.g. stored procedure) if for some reason a procedure can’t be fixed, changed or optimized in any other way, the rule that checks a procedure can be ignored. Rather than having to see the failed result repeatedly, it can be “ignored”.

By ignoring an object, results of executed rules will no longer show up as failed for that object. Instead, the status will be “ignore”. It can still be seen, to confirm that it was, indeed, processed but it won’t be included with results as failed and it won’t be included in aggregate categories for failed results and reports.

In other cases, you may have an object, that, for whatever reason, you want to exclude entirely from processing by any rules. ApexSQL Enforce allows the user to ignore an object entirely.

Ignoring results for the specific object

Before a result can be ignored, rules need to be run against a database or a SQL script. In order to ignore a result, after running checked rules, go to the Resultset grid, and right-click on a result which needs to be ignored. From the context menu, under the Ignore menu, choose the Ignore result command:

This action will open the Add reason window. Whatever is specified as a reason in the Add reason window, it should provide the information that are useful since it can be reviewed later:

After the reason is specified, click the OK button. Now, the result will be moved under the Ignore result category in the Resultset grid. Also, its icon will be changed:

Ignore reason, for each ignored result, can be reviewed at any time. To review the ignore reason, select the ignored result, go to the View tab, and click the Result details command, under the Panels sub-tab. When the Result details panel is opened, under the Message tab, the ignore reason will be shown. In the Message panel, the ignore reason cannot be changed in any way, but reviewed only:

ApexSQL Enforce allows the user to ignore several results at the same time. To ignore results, press and hold the Ctrl keyboard key and select all results that need to be ignored. Right-click on selected results and from the context menu click the Ignore result command. Make sure that all results have the same ignore reason, since only one the Add reason window will be opened:

If for any reason, the Add reason window is not necessary to show every time a result or object need to be ignored, go to the Home tab in the main ribbon and click the Options command from the Tools section. Under the Results tab of the Options dialog, uncheck the Prompt for reason when ignoring the results? option.

The next time result is chosen to be ignored the Add reason window will not be shown.

Ignored result options

For the ignored results, the context menu is slightly different. Right click on the ignored result, will show the context menu which will contain under the Ignore sub-menu, instead of the Ignore result command, the Edit reason command and the Unignore command:

To change the ignore reason, click the Edit reason command. This command will open the Add reason window, where we can change the reason, if needed:

The Unignore command will allow user to revert its decision to ignore this result/object combination. The Unignore command will back the selected, ignored result into its previous category, in our case in the Fail results category.

Ignoring objects

To ignore an object entirely, so no rules in the rulebase will be processed against it, simply select any result for that particular object, in the Resultset grid, right click on it, and from the context menu choose the Ignore object command:

All results connected to the ignored object, will be moved under the Ignore result category:

The next time the rulebase is run, any rule that was relevant for that object will be skipped, and the result for that object will be shown as ignored.

Suppressing ignored results

Ignored items can be suppressed entirely from being shown in the Resultset grid. Go to the Home tab, in the main ribbon, and click the Options command, from the Tools section. When the Options dialog is open, go to Results tab and in the Show results section, uncheck the Ignore option. This way, in the Resultset grid will not be shown the ignored items:

Another way to exclude the ignored items from the Resultset grid is to use the Result filter. In the right corner of the Result column header, click the filter icon. Check all other types of result but the ignore result type:

CLI switches for ignored items

The list of ignored items is stored in the xml file, named by a database which has been processed, on the default location C:\Users\%user%\Documents\ApexSQL\ApexSQL Enforce. For every database, a new ignore file will be created.

Switch /ignore_file specifies the ignore file path, e.g. /ignore_file:”D:\ApexSQL Enforce rulebases\ApexSQL Enforce “. If the ignore file path is not specified, the error ‘’Bad format of switch:’’ will be raised.

If an ignore file is found, on the specified path, the application will produce the output “Ignore file [<database>.xml] loaded …” to allow verification that the ignore file was found and processed.

If on a specified location, no suitable file is found, the application will proceed without ignored items.

To suppress all ignored items to be shown using CLI, use the following switch/value combination

/output_scope:failed
/output_scope:errors
/output_scope:pass

Example for using switches:

“D:\ApexSQLEnforce\ApexSQLEnforce.com” /database:Northwnd /verbose /rulebase:”D:\ApexSQL Enforce rulebases\ApexSQL (CS).axrb” /server:NENAD /ignore_file:”D:\ApexSQL Enforce rulebases\ApexSQL Enforce ” /output_scope:passed /output_scope:failed /output_scope:ignored /output_scope:errors

Q: Are the ignored items tracked in anyway?

A: The ignored items are tracked even when they are not shown in the Resultset grid. These types of information can be found in the Result summary window.

Q: Can the default Ignored rules file path be changed?

A: Yes, it can. In the Options dialog, under the Results tab you can specify any other path. Click on the Browse for folder button, and specify the new location for storing the ignore file for the database.

Q: Will the ignored items be remembered between sessions?

A: Every ignored result/object, will be remembered for the chosen database or SQL script, between sessions, and the next time we run a rulebase against that database or SQL script, that result will be declared as ignored.