Suppression Rules
Introduction
When you work on an app, Studio Pro performs consistency checks, which may result in warnings. Warnings identify issues that are not critical, but point to something that might be a problem. These warnings are shown in the Errors pane.
While warnings can be valuable, there are some situations where you might want to disable them, such as the following ones:
- You made a deliberate choice in your app that leads to a warning, and you know this will not lead to problems.
- You are using an Marketplace module that contains warnings and you do not want to change the Marketplace module.
- The number of warnings is so large that the Warnings tab is not usable anymore, and you want to temporarily disable some of them.
With Suppression rules it is possible to disable warnings. You can suppress warnings from the Errors pane and manage them via the Suppression rules option. It is also possible to suppress warnings for all Marketplace modules.
Suppression Rule Logic
Suppression rules are for one user and for one instance of an app. The warnings that you suppress are not shared between users or apps, so warnings will not be suppressed for your team members working on the same app.
Suppression rules are stored locally in the app directory, in a file called project-settings.user.json. When committing your changes to the Team Server, Studio Pro will ignore this file.
However, it is possible to export and import suppression rules manually. For more information on how to export and import warning, see Exporting Your Suppression Rules and Importing Your Suppression Rules sections.
Suppressing a Warning in the Errors Pane
From the Errors pane, you can suppress a warning for a document, a module, or the entire app:
Suppressing a Warning for a Specific Document
To suppress a warning for a specific document only, do the following:
- Right-click the warning you would like to suppress.
- Select Suppress this warning > For the document {Document name}.
The warning is only suppressed for the specific document. If the same warning appears in another document (for example, on another page), it will still be displayed for that document.
Suppressing a Warning for a Specific Module
To suppress a warning for a specific module, do the following:
- Right-click the warning you would like to suppress.
- Select Suppress this warning > For the module {Module name}.
The warning is suppressed for the whole module. If the same warning appears in another module, it will still be displayed for that module.
Suppress a Warning for the Entire App
To suppress a warning for the entire app, do the following:
- Right-click the warning you would like to suppress.
- Select Suppress this warning > For the entire project.
The warning is suppressed for the whole app and the list of warnings is updated in the Errors pane.
For more information on how to edit or delete a suppression rule, see the Managing Suppression Rules section.
Managing Suppression Rules
You can add, edit, delete, export, or import suppression rules. You can also suppress warnings from the Marketplace.
Suppressing Marketplace Warnings
To suppress Marketplace warnings, do the following:
- Click the Suppression rules button in the Errors pane.
- In the Manage Suppression Rules dialog box, check the Suppress warnings from Marketplace modules option.
- Click OK to apply the new setting.
Warnings from Marketplace modules are suppressed.
Adding a Rule
For more advanced cases, you may want to manually add a new rule. This gives you full control over the settings that the rule uses, when deciding which warnings to suppress.
To manually add a new rule, follow the steps below:
-
Click the Suppression rules button in the Errors pane.
-
In the Manage Suppression Rules dialog box, select the New button.
-
In the Add Suppression Rule dialog box, set the necessary options to add the rule (for more information on settings, see the Rule Setting section.
-
Confirm your choice by clicking OK.
-
Click OK in the Manage Suppression Rules dialog box to save your changes.
The suppression rule is created.
Editing a Rule
To edit an existing rule, follow the steps below:
-
Click the Suppression rules button in the Errors pane.
-
In the Manage Suppression Rules dialog box, select the Edit button.
-
In the Edit Suppression Rule dialog box, edit options to change the rule (for more information on settings, see the Suppression Rule Settings section.
-
Confirm your choice by clicking OK.
-
Click OK in the Manage Suppression Rules dialog box to save your changes.
The suppression rule is edited.
Deleting a Rule
To delete the existing rule, follow the steps below:
- Click the Suppression rules button in the Errors pane.
- In the Manage Suppression Rules dialog box, click the Delete button.
The suppression rule is deleted.
Importing Suppression Rules
To import suppression rules, do the following:
-
Click the Suppression rules button in the Errors pane.
-
In the Manage Suppression Rules dialog box, select the Import button.
-
Browse to the folder where you would like to import (the file extension that you are importing must be .suppressions.json).
-
Click Open to select the file.
-
In a confirmation pop-up window, click OK to dismiss it:
-
Click OK in the Manage Suppression Rules dialog box.
The list of warnings is updated.
Exporting Your Suppression Rules
To export your suppression rules, do the following:
-
Click the Suppression rules button in the Errors pane.
-
In the Manage Suppression Rules dialog box, select the Export button.
-
Browse to the folder where you wish to export the rules (by default the file name is
<your app name>.suppressions.json
). -
Click the Save button to save the exported rules.
-
In a confirmation pop-up window, click OK to dismiss it:
-
Click OK in the Manage Suppression Rules dialog box.
Your suppression rules are exported. Another user can import that file to use the same suppression rules.
Suppression Rule Settings
The table below describes the available settings:
Setting | Description |
---|---|
Module | Suppresses warnings within the selected module. When (All) is selected, the rule applies to all modules. |
Document | Suppresses warnings within the selected document. When (All) is selected, the rule applies to all documents in the selected module. Note: to select a particular document, you first need to select a Module. |
Suppress for | Allows you to suppress a warning for a specific error code or for all warnings. |
Value | Only displayed when the Error code option is selected in the Suppress for selector above. You can type in a specific error code, for example CW1234, to suppress only this specific warning. |