Dialog: Static Analysis Settings: Naming Conventions
Function: In the dialog, you define the prefixes for the data types and scopes of variables, as well as prefixes for POUs and user-defined data types (DUTs). Static Analysis checks compliance with the naming conventions. When a convention is not observed, the static analysis reports an error message in the Messages view. For more information,see: Configuring and Running Static Analysis
Call:
Static Analysis category, Open configuration dialog link
menu,menu
Requirement:
The CODESYS Static Analysis package is installed.
A project is open.
The error messages are displayed in the following format:
NC <prefix of convention number> :
<message text>
. NC stands for "naming convention". For example, the error message NC0102: Invalid name… means a violation of naming convention 102 for POUs of type
PROGRAM
.
Tip
You can use the 'naming'
pragma to deactivate naming conventions for individual identifiers. The identifiers can begin with anything, not necessarily with the prefix.
Filter | Input field for strings to be searched for |
Table with the naming conventions | |
Names | Nodes and elements for which a prefix can be defined. The number in parentheses after each element (for example, PROGRAM (102)) is the prefix convention number that is reported in the case of noncompliance with a naming convention. |
Prefix | Input field of the prefix
|
Prefixes for variables | Organizational node for all variables for which a prefix can be defined dependent on data type or scope. |
Prefixes for POUs | Organizational node for all POU types and method scopes for which a prefix can be defined |
Prefixes for DUTs | Organizational node for the DUT data types (structure, enumeration, alias, or union) for which a prefix can be defined |
Prefixes for custom types | Organizational node for special custom types (particularly those from libraries) You can extend the list with conventions: Click the blank space below it. In the Input Assistant dialog, specify the name of a custom type or select a custom type. To delete a convention, select it and press the Del key. Note: These conventions have priority over the prefixes which are defined with the attribute |
Options | |
First character after prefix should be an upper case letter |
|
Combine scope prefix with data type prefix |
Example: The following prefixes are defined: The code analysis reports errors for global REAL variables that do not have the prefix
Example: The following prefixes are defined: The code analysis reports exclusively errors for global |
Recursive prefixes for combinable data types |
Example:
The prefix Static analysis reports errors for all variables of type
The prefix Static analysis reports errors for all variables of type |
Example
The following naming convention corresponds for the most part to the recommendations which are described in CODESYS for the "identifiers".



Example
The naming convention (1) refers to the standard POU TON
. As a result, declarations of the special library POU are checked for the prefix "ton_". Click the blank space (2) to insert more naming conventions.
