s12

en

name

Conditional instructions should have a default case

description

When using an instruction IF or an instruction CASE in structured text, it is important to always add a default case handler: an ELSE part for IF instructions or DEFAULT for CASE instructions.

Detailed explanation : When always writing default cases for conditional instructions, readers know that all decision paths have been taken into account. Warning, that this rule is used only for code written in Structured Text language.

Level :

errorMessage

  • a) Conditional instruction at {LOCATION} has no default case (ELSE part or DEFAULT part)

fr

name

Les instructions conditionnelles doivent gérer le cas par défaut

description

Lorsque le programmeur utilise des instructions conditionnelles comme le IF ou le CASE en ST, il doit toujours prendre en compte le cas où toutes les conditions sont fausses et donc prévoir ce cas là explicitement. Attention cette règle ne s'applique que sur le langage littéral structuré.

Explication complémentaire : Lorsque toutes les instructions conditionnelles ont leur cas par défaut qui est prévu, le mainteneur sait que tous les chemins possibles ont été pris en compte. Dans le cas contraire, il est possible que le programmeur ait oublié un cas important.

Niveau conseillé :

errorMessage

  • a) L'instruction conditionnelle en {LOCATION} n'a pas de cas par défaut

it

name

Le istruzioni condizionali devono avere un caso di default

description

Quando utilizza istruzioni condizionali come IF o CASE nel linguaggio Structured Text, lo sviluppatore deve sempre tenere presente il caso in cui tutte le condizioni siano false e quindi dovrà prevederlo esplicitamente. Attenzione: questa regola si applica soltanto al linguaggio Structured.

Spiegazione supplementare: se tutte le istruzioni condizionali hanno il loro caso di default, chi si occupa della manutenzione del codice sa che sono stati presi in considerazione tutti i possibili percorsi. In caso contrario, è possibile che lo sviluppatore abbia dimenticato un caso importante.

Livello consigliato:

errorMessage

  • a) L'istruzione condizionale in {LOCATION} non ha un caso di default

de

name

Bedingte Anweisungen sollten einen Standardfall haben

description

Wenn man eine bedingte Anweisung IF oder CASE in Structured Text benutzt ist es wichtig, immer auch einen Standardfall einzubinden: einen ELSE-Teil für IF-Anweisungen und einen Standardfall für CASE-Anweisungen.

Vertiefende Erklärung : Wenn bei bedingten Anweisungen immer ein Standardfall vorhanden ist, weiß der Leser, dass alle Entscheidungswege berücksichtigt wurden. Achtung: diese Regel wird nur auf Programmteile angewandt, die in Structured Text geschrieben wurden.

Level :

errorMessage

  • a) Die bedingte Anweisung an der Stelle {LOCATION} hat keinen Standardfall (ELSE oder DEFAULT)