File tree Expand file tree Collapse file tree 1 file changed +12
-15
lines changed Expand file tree Collapse file tree 1 file changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -458,24 +458,21 @@ def filter_functions(
458458 malformed_paths_count += 1
459459 continue
460460 if blocklist_funcs :
461- for function in functions .copy ():
462- path = Path (function .file_path ).name
463- if path in blocklist_funcs :
464- console .print ("this path contains blocklisted functions" )
465- if function .function_name in blocklist_funcs [path ]:
466- console .print (
467- f"blocklist: Removing { function .function_name } in { path } because it is blocklisted"
468- )
469- functions .remove (function )
470- else :
471- console .print (
472- f"blocklist: Keeping { function .function_name } in { path } because it is not blocklisted"
473- )
474- else :
461+ filtered_functions = []
462+ for function in functions :
463+ should_keep = True
464+
465+ rel_path = str (Path (function .file_path ).relative_to (project_root ))
466+
467+ if rel_path in blocklist_funcs and function .function_name in blocklist_funcs [rel_path ]:
475468 console .print (
476- f"blocklist: Keeping { function .function_name } in { path } because the path is not in the blocklist "
469+ f"blocklist: Removing { function .function_name } in { rel_path } because it is blocklisted "
477470 )
471+ should_keep = False
478472
473+ if should_keep :
474+ filtered_functions .append (function )
475+ functions = filtered_functions
479476 filtered_modified_functions [file_path ] = functions
480477 functions_count += len (functions )
481478 if not disable_logs :
You can’t perform that action at this time.
0 commit comments