G-4210
🆓Warning
Try to use CASE rather than an IF statement with multiple ELSIF paths.
Reason
if
statements containing multiple elsif
tend to become complex quickly.
Example
Non-Compliant Example
declare l_color types_up.color_code_type; begin if l_color = constants_up.co_red then my_package.do_red(); elsif l_color = constants_up.co_blue then my_package.do_blue(); elsif l_color = constants_up.co_black then my_package.do_black(); end if; end; /
Issues
Line | Column | Message |
---|---|---|
4 | 4 |
★★★★★
Compliant Solution -
declare l_color types_up.color_code_type; begin case l_color when constants_up.co_red then my_package.do_red(); when constants_up.co_blue then my_package.do_blue(); when constants_up.co_black then my_package.do_black(); end case; end; /
Parameters
Use parameters to customize the rule to your needs.
Parameter | Description | Default Value |
---|---|---|
DisableAllQuickFix | Comma-separated ist of rules for which a quick fix should not be applied to all the problems in a file. | Core G-3130 |
References
- same as Trivadis G-4210