Skip to main content

Dialog: Static Analysis Settings: Rules

Function: In the dialog, you select the rules that are checked during the static analysis of the source code of a project.

For more information, see: Configuring and Running Static Analysis

Call:

  • Project → Project Settings menu, Static Analysis category, Open configuration dialog link

  • Build → Static Analysis → Settings menu

Requirement:

  • The CODESYS Static Analysis package is installed.

  • A project is open.

This tab shows a tree structure of all rules that can be checked during static analysis. By default, every rule is activated, with the exception of SA0016, SA0024, SA0073, SA0101, SA0105, SA0106, SA0133, SA0134, SA0150, SA0162, and all "strict IEC rules".

Each rule has a unique number. When the rule is checked and a violation is detected, the rule number and an error description are shown in the message view in the Build category in the following format: SA<rule number>, where "SA" stands for "Static Analysis" (example: "SA003" for rule 3).

Tip

The list of available rules can be extended by specific plug-ins.

Filter

Input field for the strings to be searched for

_cds_icon_filter_category.png

Rules are grouped by category.

  • Structured by Importance: Sorting by Importance High, Importance Medium, and Importance Low

  • Default: Default structuring of the rules in CODESYS Static Analysis

_cds_icon_filter_list.png

_cds_icon_filter_list.png: Rules are displayed as a flat list. By clicking on the corresponding column header, the list can be sorted by rule number, activation/deactivation, rule-specific configuration, or importance.

Some rules that are activated in the dialog can be deactivated temporarily in the application by applying a pragma.

When you click the check box, the setting toggles between _cds_icon_option_deactivated.png, sa_icon_checked_red.png, and sa_icon_checked_yellow.png.

When you activate or deactivate a parent node, all child rules are also activated or deactivated, respectively.

Columns

Rules

List of rules with rule number

Rule check

  • _cds_icon_option_deactivated.png: The rule is not checked.

  • sa_icon_checked_red.png: If the result of the check is positive, then an error (sa_icon_runstaticanalysis.png) for the static analysis is issued in the message view.

  • sa_icon_checked_yellow.png: If the result of the check is positive, then a warning (sa_icon_warning.png) for the static analysis is issued in the message view.

Precompile

_san_icon_precompile_check_possible.png:

Rules which can be checked during precompile are identified by a check mark (_san_icon_precompile_check_possible.png ) in this column. This means that the rules are already checked when the code is entered.

An immediate bugfix (Quickfix) is possible for these rules. You can execute an automatic, immediate error handling directly at the affected code positions.

_san_img_not_checked.png:

Rules which are not marked are checked only after a successful compile.

Rule specific configuration

For some rules, you can double-click the field to open a rule-specific dialog to configure the rule.

Importance:

Importance of the rule:

  • 3 red stars: High

  • 2 orange stars: Medium

  • 1 gray star: Low