Detects external access to local variables of programs or function blocks
Justification: CODESYS permits external read access to local variables of programs or function blocks. This contradicts the principle of data encapsulation (hiding data) and does not comply with the IEC 61131-3 standard.
Importance: Medium
Example
PROGRAM PLC_PRG VAR iCounter : INT; afb_Instance : AFB; bfb_Instance : BFB; END_VAR iCounter := A_PRG.iLocal; // SA0102 iCounter := bfb_Instance.iLocal; // SA0102 A_PRG(); FUNCTION_BLOCK AFB VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR iLocal: INT; END_VAR METHOD METH : INT VAR_INPUT END_VAR iLocal := iLocal + 1; FUNCTION_BLOCK BFB EXTENDS AFB VAR_INPUT END_VAR VAR_OUTPUT END_VAR VAR END_VAR METHOD METH : INT VAR_INPUT END_VAR iLocal := iLocal + 1; PROGRAM A_PRG VAR iLocal: INT; END_VAR iLocal := iLocal + 1; --> SA0102: Access to program/fb variable 'iLocal' from the outside