Metric: Commented Variables (In+Out+Global) Ratio

User Description

This metric calculates the ratio (Unit: %) between commented and not commented variables that are defined in VAR_GLOBAL, VAR_INPUT, VAR_OUTPUT, or VAR_IN_OUT.

Metric Calculation

Each variable declaration in objects (function (FUN), function block (FB), Data Unit Type (DUT), Global Variable List (GVL), and so on) are verified whether they are commented or not.

The ratio between these two values is provided with this metric.

Example

Commented variables (in+out+global) ratio calculation example:

Declaration:
1: PROGRAM SR_Main
2: VAR_IN
3:     i_xCheck1: BOOL;//flag to identify
3:     i_uiMyVariable2: UINT;
4: END_VAR
2: VAR
3:     xFlag: BOOL;
4: END_VAR

Commented variables (in+out+global) ratio result: 50 %