G-4270
🆓Warning
Avoid comparing boolean values to boolean literals.
Reason
It is more readable to simply use the boolean value as a condition itself, rather than use a comparison condition comparing the boolean value to the literals true or false.
Example
Non-Compliant Example
declare
co_string constant types_up.text := '42';
l_is_valid boolean;
begin
l_is_valid := my_package.is_valid_number(co_string);
if l_is_valid = true then
my_package.convert_number(l_string);
end if;
end;
/Issues
| Line | Column | Message |
|---|---|---|
| 6 | 7 |
Compliant Solution - ★★★★★
declare
co_string constant types_up.text := '42';
l_is_valid boolean;
begin
l_is_valid := my_package.is_valid_number(co_string);
if l_is_valid then
my_package.convert_number(l_string);
end if;
end;
/Parameters
Use parameters to customize the rule to your needs.
| Parameter | Description | Default Value |
|---|---|---|
| DisableAllQuickFix | Comma-separated list of rules for which a quick fix should not be applied to all the problems in a file. | Core G-3130 |
References
- same as plsqlopen:ComparisonWithBoolean
- same as Trivadis G-4270