Attribute 'naming'Permalink

The attribute marks the code lines that are excluded from the analysis of naming convention. An ‎off‎ is assigned to the pragma attribute before the first code line where the code analysis is deactivated. An ‎on‎ is assigned after the last line. When an ‎omit‎ is assigned, only the next code line is ignored.

Insert location: Deactivation: In the declaration part of POUs and DUTs, above the affected lines. Activation: Below the affected lines.

Syntax:

{attribute 'naming' := '<switch state>'}
<switch state> : on | off | omit
on : naming is switched on
off : naming is switched off
omit : only next code line is switched off

Example

Defined naming conventions: 1) INT variable names must be prepended with "int" as the identifier prefix, for example "intVar1". 2) Program names must begin with "prog".

For the code presented below, the static analysis issues messages only for the following variables: ‎cccVar‎, ‎aVariable‎, and ‎bVariable‎.

VAR
{attribute 'naming' := 'off'} 
	iVarA : INT;
	iVarB : INT; 
{attribute 'naming' := 'on'} 
	iVarC : INT;
END_VAR
VAR
	...
{attribute 'naming' := 'omit'} 
	iVarC : INT;
...
END_VAR
{attribute 'naming' := 'omit'}
PROGRAM PLC_PRG
VAR
...
END_VAR
{attribute 'naming' := 'off'} 
PROGRAM DoSomethingA 
VAR
{attribute 'naming' := 'on'} 
	iVarA : INT; 
	iVarB : INT; 
		…
VAR_END