@@ -84,7 +84,7 @@ def discover_functions(
8484 try :
8585 source = file_path .read_text (encoding = "utf-8" )
8686 except Exception as e :
87- logger .warning (f "Failed to read { file_path } : { e } " )
87+ logger .warning ("Failed to read %s: %s" , file_path , e )
8888 return []
8989
9090 try :
@@ -129,7 +129,7 @@ def discover_functions(
129129 return functions
130130
131131 except Exception as e :
132- logger .warning (f "Failed to parse { file_path } : { e } " )
132+ logger .warning ("Failed to parse %s: %s" , file_path , e )
133133 return []
134134
135135 def discover_functions_from_source (self , source : str , file_path : Path | None = None ) -> list [FunctionInfo ]:
@@ -184,7 +184,7 @@ def discover_functions_from_source(self, source: str, file_path: Path | None = N
184184 return functions
185185
186186 except Exception as e :
187- logger .warning (f "Failed to parse source: { e } " )
187+ logger .warning ("Failed to parse source: %s" , e )
188188 return []
189189
190190 def _get_test_patterns (self ) -> list [str ]:
@@ -248,7 +248,7 @@ def discover_tests(self, test_root: Path, source_functions: Sequence[FunctionInf
248248 TestInfo (test_name = test_name , test_file = test_file , test_class = None )
249249 )
250250 except Exception as e :
251- logger .debug (f "Failed to analyze test file { test_file } : { e } " )
251+ logger .debug ("Failed to analyze test file %s: %s" , test_file , e )
252252
253253 return result
254254
@@ -299,7 +299,7 @@ def extract_code_context(self, function: FunctionInfo, project_root: Path, modul
299299 try :
300300 source = function .file_path .read_text ()
301301 except Exception as e :
302- logger .exception (f "Failed to read { function .file_path } : { e } " )
302+ logger .exception ("Failed to read %s: %s" , function .file_path , e )
303303 return CodeContext (target_code = "" , target_file = function .file_path , language = Language .JAVASCRIPT )
304304
305305 # Find imports and helper functions
@@ -623,7 +623,7 @@ def _find_helper_functions(
623623 helpers .extend (file_helpers )
624624
625625 except Exception as e :
626- logger .debug (f "Failed to find cross-file helpers: { e } " )
626+ logger .debug ("Failed to find cross-file helpers: %s" , e )
627627
628628 return helpers
629629
@@ -866,7 +866,7 @@ def _find_imported_type_definitions(
866866 break
867867
868868 except Exception as e :
869- logger .debug (f "Failed to resolve type definition for { local_name } : { e } " )
869+ logger .debug ("Failed to resolve type definition for %s: %s" , local_name , e )
870870 continue
871871
872872 return found_definitions
@@ -888,7 +888,7 @@ def find_helper_functions(self, function: FunctionInfo, project_root: Path) -> l
888888 imports = analyzer .find_imports (source )
889889 return self ._find_helper_functions (function , source , analyzer , imports , project_root )
890890 except Exception as e :
891- logger .warning (f "Failed to find helpers for { function .name } : { e } " )
891+ logger .warning ("Failed to find helpers for %s: %s" , function .name , e )
892892 return []
893893
894894 # === Code Transformation ===
@@ -913,7 +913,7 @@ def replace_function(self, source: str, function: FunctionInfo, new_source: str)
913913
914914 """
915915 if function .start_line is None or function .end_line is None :
916- logger .error (f "Function { function . name } has no line information" )
916+ logger .error ("Function %s has no line information" , function . name )
917917 return source
918918
919919 # Get analyzer for parsing
@@ -925,7 +925,7 @@ def replace_function(self, source: str, function: FunctionInfo, new_source: str)
925925 # Extract just the method body from the new source
926926 new_body = self ._extract_function_body (new_source , function .name , analyzer )
927927 if new_body is None :
928- logger .warning (f "Could not extract body for { function . name } from optimized code, using full replacement" )
928+ logger .warning ("Could not extract body for %s from optimized code, using full replacement" , function . name )
929929 return self ._replace_function_text_based (source , function , new_source , analyzer )
930930
931931 # Find the original function and replace its body
@@ -1062,7 +1062,7 @@ def find_function_at_line(node, target_name: str, target_line: int):
10621062
10631063 func_node = find_function_at_line (tree .root_node , function .name , function .start_line )
10641064 if not func_node :
1065- logger .warning (f "Could not find function { function . name } at line { function .start_line } " )
1065+ logger .warning ("Could not find function %s at line %s" , function .name , function . start_line )
10661066 return source
10671067
10681068 # Find the body node in the original
@@ -1074,7 +1074,7 @@ def find_function_at_line(node, target_name: str, target_line: int):
10741074 break
10751075
10761076 if not body_node :
1077- logger .warning (f "Could not find body for function { function .name } " )
1077+ logger .warning ("Could not find body for function %s" , function .name )
10781078 return source
10791079
10801080 # Get the indentation of the original body's opening brace
@@ -1250,7 +1250,7 @@ def format_code(self, source: str, file_path: Path | None = None) -> str:
12501250 except (subprocess .TimeoutExpired , FileNotFoundError ):
12511251 pass
12521252 except Exception as e :
1253- logger .debug (f "Prettier formatting failed: { e } " )
1253+ logger .debug ("Prettier formatting failed: %s" , e )
12541254
12551255 return source
12561256
@@ -1300,10 +1300,10 @@ def run_tests(
13001300 return results , junit_xml
13011301
13021302 except subprocess .TimeoutExpired :
1303- logger .warning (f "Test execution timed out after { timeout } s" )
1303+ logger .warning ("Test execution timed out after %ss" , timeout )
13041304 return [], junit_xml
13051305 except Exception as e :
1306- logger .exception (f "Test execution failed: { e } " )
1306+ logger .exception ("Test execution failed: %s" , e )
13071307 return [], junit_xml
13081308
13091309 def parse_test_results (self , junit_xml_path : Path , stdout : str ) -> list [TestResult ]:
@@ -1363,7 +1363,7 @@ def parse_test_results(self, junit_xml_path: Path, stdout: str) -> list[TestResu
13631363 )
13641364 )
13651365 except Exception as e :
1366- logger .warning (f "Failed to parse JUnit XML: { e } " )
1366+ logger .warning ("Failed to parse JUnit XML: %s" , e )
13671367
13681368 return results
13691369
@@ -1731,10 +1731,10 @@ def instrument_source_for_line_profiler(
17311731
17321732 # Write instrumented code to source file
17331733 source_file_path .write_text (instrumented_source , encoding = "utf-8" )
1734- logger .debug (f "Wrote instrumented source to { source_file_path } " ) # noqa: G004
1734+ logger .debug ("Wrote instrumented source to %s" , source_file_path )
17351735 return True # noqa: TRY300
17361736 except Exception as e :
1737- logger .warning (f "Failed to instrument source for line profiling: { e } " ) # noqa: G004
1737+ logger .warning ("Failed to instrument source for line profiling: %s" , e )
17381738 return False
17391739
17401740 def parse_line_profile_results (self , line_profiler_output_file : Path ) -> dict :
@@ -1746,7 +1746,7 @@ def parse_line_profile_results(self, line_profiler_output_file: Path) -> dict:
17461746 # Format output string for display
17471747 str_out = self ._format_js_line_profile_output (parsed_results )
17481748 return {"timings" : parsed_results .get ("timings" , {}), "unit" : 1e-9 , "str_out" : str_out }
1749- logger .warning (f "No line profiler output file found at { line_profiler_output_file } " ) # noqa: G004
1749+ logger .warning ("No line profiler output file found at %s" , line_profiler_output_file )
17501750 return {"timings" : {}, "unit" : 0 , "str_out" : "" }
17511751
17521752 def _format_js_line_profile_output (self , parsed_results : dict ) -> str :
@@ -1984,6 +1984,6 @@ def format_code(self, source: str, file_path: Path | None = None) -> str:
19841984 except (subprocess .TimeoutExpired , FileNotFoundError ):
19851985 pass
19861986 except Exception as e :
1987- logger .debug (f "Prettier formatting failed: { e } " )
1987+ logger .debug ("Prettier formatting failed: %s" , e )
19881988
19891989 return source
0 commit comments