Trivadis / plsql-cop-cli

db* CODECOP Command Line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple G-7430 emitted when parent function has nested functions.

DavidotNet opened this issue · comments

Seems as if zero (0) G-7430 should be emitted, not three (3) of them.

14 10 2-Major Maintainability, Testability G-7430: Try to use no more than one RETURN statement within a function.
26 10 2-Major Maintainability, Testability G-7430: Try to use no more than one RETURN statement within a function.
30 4 2-Major Maintainability, Testability G-7430: Try to use no more than one RETURN statement within a function.

create or replace function fn_test_rule (
b_switch_in in boolean
) return varchar2
is
function f_check_positive
return varchar2
is
v_string1 varchar2(8 char);
begin
if b_switch_in
then
v_string1 := 'TRUE';
end if;
return v_string1;
end;
-- --------------------------------
function f_check_negative
return varchar2
is
v_string2 varchar2(8 char);
begin
if NOT b_switch_in
then
v_string2 := 'FALSE';
end if;
return v_string2;
end;

begin -- Parent
return f_check_positive() || f_check_negative();
end fn_test_rule;