@@ -202,17 +202,37 @@ def _truncate_context(context: str, matched: str) -> str:
202202
203203
204204def _wrap_sheet_hyperlink (url : str , label : str ) -> str :
205+ """Wraps a URL and label into a Google Sheets HYPERLINK formula.
206+
207+ This ensures that when output is imported into spreadsheet software, the
208+ resulting cells contain clickable hyperlinks pointing directly to GitHub file
209+ locations and line numbers.
210+ """
205211 return f'=HYPERLINK("{ url } ", "{ label } ")'
206212
207213
208214def _wrap_sheet_string (value : str ) -> str :
215+ """Wraps a string value inside a spreadsheet string formula to prevent float parsing.
216+
217+ This forces spreadsheet software (such as Google Sheets) to treat numeric
218+ string patterns (like python runtime version "3.10") as literal strings,
219+ preventing auto-truncation to floats (which would display "3.1"). Double
220+ quotes inside the value are escaped by doubling them to avoid formula syntax
221+ errors on import.
222+ """
209223 if value is None :
210224 return ""
211225 escaped_value = value .replace ('"' , '""' )
212226 return f'="{ escaped_value } "' if value else ""
213227
214228
215229def _safe_int (value : Any , default : int = 0 ) -> int :
230+ """Safely converts a value to an integer, falling back to a default value.
231+
232+ Used primarily during raw data formatting for spreadsheet ingestion. If a
233+ value (like a line number) is missing or contains non-integer text (e.g. empty
234+ strings for filename-only matches), this avoids crashing the scanner.
235+ """
216236 try :
217237 return int (value )
218238 except (ValueError , TypeError ):
0 commit comments