Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52c0307

Browse files
committed
Addresing sonar issues
1 parent 83dbdaa commit 52c0307

3 files changed

Lines changed: 13 additions & 15 deletions

File tree

source/api/ut_runner.pkb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,15 @@ create or replace package body ut_runner is
195195
l_cursor sys_refcursor;
196196
l_results ut_suite_items_info;
197197
c_bulk_limit constant integer := 100;
198+
i pls_integer;
198199
begin
199200
l_cursor := ut_suite_manager.get_suites_info(ut_varchar2_list(nvl(a_path,sys_context('userenv', 'current_schema'))));
200201
loop
201202
fetch l_cursor bulk collect into l_results limit c_bulk_limit;
202-
for i in 1 .. l_results.count loop
203+
i := l_results.first;
204+
while (i is not null) loop
203205
pipe row (l_results(i));
206+
i := l_results.next(i);
204207
end loop;
205208
exit when l_cursor%notfound;
206209
end loop;

source/core/ut_suite_cache_manager.pkb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ create or replace package body ut_suite_cache_manager is
131131
c_package_path_regex constant varchar2(100) := '^([A-Za-z0-9$#_]+)(\.([A-Za-z0-9$#_\*]+))?(\.([A-Za-z0-9$#_\*]+))?$';
132132
l_results ut_path_items := ut_path_items();
133133
l_path_item ut_path_item;
134+
i pls_integer;
134135
begin
135-
for i in 1 .. a_paths.count loop
136+
i := a_paths.first;
137+
while (i is not null) loop
136138
l_results.extend;
137139
if a_paths(i) like '%:%' then
138140
l_path_item := ut_path_item(schema_name => upper(regexp_substr(a_paths(i),'^[^.:]+')),
@@ -143,7 +145,8 @@ create or replace package body ut_suite_cache_manager is
143145
object_name => regexp_substr(a_paths(i), c_package_path_regex, subexpression => 3),
144146
procedure_name => regexp_substr(a_paths(i), c_package_path_regex, subexpression => 5));
145147
l_results(l_results.last) := l_path_item;
146-
end if;
148+
end if;
149+
i := a_paths.next(i);
147150
end loop;
148151

149152
return l_results;
@@ -189,7 +192,7 @@ create or replace package body ut_suite_cache_manager is
189192
bulk collect into l_schema_paths
190193
from
191194
(select schema_name,object_name,procedure_name,suite_path,
192-
row_number() over ( partition by schema_name,object_name,procedure_name,suite_path order by 1) r_num
195+
row_number() over ( partition by schema_name,object_name,procedure_name,suite_path order by 1) as r_num
193196
from paths_to_expand)
194197
where r_num = 1 ;
195198
return l_schema_paths;
@@ -211,7 +214,7 @@ create or replace package body ut_suite_cache_manager is
211214
begin
212215
select obj bulk collect into l_suite_items
213216
from (
214-
select /*+ cardinality(c 500) */ value(c) as obj,row_number() over ( partition by path order by path asc) r_num
217+
select /*+ cardinality(c 500) */ value(c) as obj,row_number() over ( partition by path order by path asc) as r_num
215218
from ut_suite_cache c,
216219
table(a_schema_paths) sp
217220
where c.object_owner = upper(sp.schema_name)
@@ -301,7 +304,7 @@ create or replace package body ut_suite_cache_manager is
301304
l_procedure_name varchar2(250) := ut_utils.qualified_sql_name(a_procedure_name);
302305
l_schema_paths ut_path_items;
303306
begin
304-
l_schema_paths := ut_path_items(ut_path_item(a_object_owner,a_object_name,a_procedure_name,a_path));
307+
l_schema_paths := ut_path_items(ut_path_item(l_object_owner,l_object_name,l_procedure_name,a_path));
305308
return get_cached_suite_rows(l_schema_paths,a_random_seed,l_tags);
306309
end;
307310

@@ -314,10 +317,6 @@ create or replace package body ut_suite_cache_manager is
314317
l_suite_items ut_suite_cache_rows := ut_suite_cache_rows();
315318
l_schema_paths ut_path_items;
316319
l_tags ut_varchar2_rows := coalesce(a_tags,ut_varchar2_rows());
317-
318-
l_suite_item_name varchar2(20);
319-
l_paths ut_varchar2_rows;
320-
l_schema varchar2(4000);
321320
l_sql varchar2(32767);
322321
begin
323322

source/core/ut_suite_manager.pkb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,9 @@ create or replace package body ut_suite_manager is
8282
l_schema := sys.dbms_assert.schema_name(upper(l_object));
8383
exception
8484
when sys.dbms_assert.invalid_schema_name then
85-
if l_object like '%*%' then
85+
if l_object like '%*%' or ut_metadata.package_exists_in_cur_schema(upper(l_object)) then
8686
a_paths(i) := c_current_schema || '.' || a_paths(i);
8787
l_schema := c_current_schema;
88-
elsif ut_metadata.package_exists_in_cur_schema(upper(l_object)) then
89-
a_paths(i) := c_current_schema || '.' || a_paths(i);
90-
l_schema := c_current_schema;
9188
else
9289
raise;
9390
end if;
@@ -531,7 +528,6 @@ create or replace package body ut_suite_manager is
531528
l_paths ut_varchar2_list := a_paths;
532529
l_schema_names ut_varchar2_rows;
533530
l_schema_paths ut_path_items;
534-
l_reconcile_paths ut_path_items;
535531
l_schema varchar2(4000);
536532
begin
537533
ut_event_manager.trigger_event('configure_execution_by_path - start');

0 commit comments

Comments
 (0)