Trivadis / plsql-cop-cli

db* CODECOP Command Line
Other
24 stars 1 forks source link

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

Closed DavidotNet closed 5 months ago

DavidotNet commented 5 months ago

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;

PhilippSalvisberg commented 5 months ago

closed with #15, see https://github.com/Trivadis/plsql-cop-cli/issues/15#issuecomment-1880925028