Rules

In the Rules tab you can configure the rules that are taken into account when the static analysis is performed. The rules are displayed as a tree structure in the project properties. Some rules are arranged below organizational nodes.

The rules alert you to possibly inadvertent and erroneous implementations so that you can optimize these program parts at an early stage.

 

Up to three configuration options are available for the rules:

1. Configuration of the control activity

Individual rules can be enabled or disabled via the checkbox for the respective row. Ticking the checkbox for a subnode affects all entries below this node. Ticking the checkbox for the top node affects all list entries. The entries below a node can be collapsed or expanded by clicking on the minus or plus sign to the left of the node name.

The number in brackets after each rule, for example "Unreachable code (1)", is the rule number that is issued if the rule is not observed, e.g. "SA0001".

The following three settings are available, which can be accessed by repeated clicking on the checkbox:

2. Configuration of the precompile behavior

Most Static Analysis rules can already be checked during precompilation. You can use the following options to configure whether you want the result of this check to be displayed as a precompile message in the message window.

The two options mentioned above allow you to configure whether you want to receive precompile messages at all. If so, you can also specify in detail which rules this should apply to.

Consequently, precompile messages are only issued for a specific rule if the following conditions are met:

3. Configuration of control parameters/limits

Some rules can be parameterized, allowing limits to be set individually, for example. You can configure the parameters to be taken into account in the respective check by double-clicking on the row of the corresponding rule in the rule configuration (PLC project properties > "Static Analysis" category > "Rules" tab). You can set the control parameters in the dialog that opens. The currently configured parameters are displayed in the "Limits" column of the control configuration.

An overview of the parameterizable rules can be found on the following page: Rules - overview and description

 

More Information:

Syntax of rule violations in the message window

Each rule has a unique number (shown in parentheses after the rule in the rule configuration view). If a rule violation is detected during the static analysis, the number together with an error or warning description is issued in the message window, based on the following syntax. The abbreviation "SA" stands for "Static Analysis".

Syntax: "SA<rule number>: <rule description>"

Sample for rule number 33 (unused variables): "SA0033: Not used: variable 'bSample'"

Temporary disabling of rules

Rules that are enabled in this dialog can be temporarily disabled in the project via a pragma. For further information please refer to Pragmas and attributes.

 

Overview and description of the rules

An overview of the rules and a detailed description of the rules can be found at Rules - overview and description.