Skip to content

Commit 9c49e09

Browse files
committed
fix(version-scanner): use Dict[str, Any] type hints for match formatters to prevent type mismatch
1 parent 7b21764 commit 9c49e09

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

scripts/version_scanner/version_scanner.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def load_config(self) -> List[Dict[str, str]]:
146146

147147
return resolved_rules
148148

149-
def scan_file(file_path: str, compiled_rules: List[Dict[str, re.Pattern]]) -> List[Dict[str, str]]:
149+
def scan_file(file_path: str, compiled_rules: List[Dict[str, re.Pattern]]) -> List[Dict[str, Any]]:
150150
"""
151151
Scan a single file for matching patterns.
152152
@@ -239,7 +239,7 @@ def _safe_int(value: Any, default: int = 0) -> int:
239239
return default
240240

241241

242-
def format_for_raw_csv(match: Dict[str, str]) -> Dict[str, str]:
242+
def format_for_raw_csv(match: Dict[str, Any]) -> Dict[str, Any]:
243243
"""Prepares a full raw dataset (n + x columns) with clean text values."""
244244
file_name = match.get("file_name")
245245
if not file_name and match.get("file_path"):
@@ -258,10 +258,10 @@ def format_for_raw_csv(match: Dict[str, str]) -> Dict[str, str]:
258258

259259

260260
def format_for_spreadsheet(
261-
match: Dict[str, str],
261+
match: Dict[str, Any],
262262
github_repo: str = None,
263263
branch: str = "main"
264-
) -> Dict[str, str]:
264+
) -> Dict[str, Any]:
265265
"""Builds on top of raw CSV but applies Sheets-specific formulas."""
266266
formatted = format_for_raw_csv(match)
267267

@@ -276,7 +276,7 @@ def format_for_spreadsheet(
276276
return formatted
277277

278278

279-
def format_for_console(match: Dict[str, str]) -> str:
279+
def format_for_console(match: Dict[str, Any]) -> str:
280280
"""Prepares a slim, readable string representation (n columns) for stdout/logs."""
281281
file_path = match.get("file_path", "")
282282
line_number = match.get("line_number", "")
@@ -286,7 +286,7 @@ def format_for_console(match: Dict[str, str]) -> str:
286286

287287

288288

289-
def get_match_counts(matches: List[Dict[str, str]]) -> Tuple[Dict[str, int], Dict[str, int]]:
289+
def get_match_counts(matches: List[Dict[str, Any]]) -> Tuple[Dict[str, int], Dict[str, int]]:
290290
"""
291291
Aggregate matches by rule and by package.
292292
"""
@@ -339,7 +339,7 @@ def load_ignore_file(file_path: str) -> List[str]:
339339

340340
def write_csv_report(
341341
output_path: str,
342-
matches: List[Dict[str, str]]
342+
matches: List[Dict[str, Any]]
343343
) -> None:
344344
"""
345345
Write the collected matches to a CSV file.
@@ -366,7 +366,7 @@ def write_csv_report(
366366
print(f"Error writing CSV report: {e}", file=sys.stderr)
367367

368368

369-
def upload_to_drive(csv_path: str, matches: List[Dict[str, str]], github_repo: str = None, branch: str = "main") -> str:
369+
def upload_to_drive(csv_path: str, matches: List[Dict[str, Any]], github_repo: str = None, branch: str = "main") -> str:
370370
"""
371371
Upload matches to a Google Sheet in Drive.
372372
"""
@@ -469,7 +469,7 @@ def scan_repository(
469469
target_packages: List[str] = None,
470470
ignore_dirs: List[str] = None,
471471
version_string: str = None
472-
) -> List[Dict[str, str]]:
472+
) -> List[Dict[str, Any]]:
473473
"""
474474
Scans the repository directory tree applying resolved regex patterns to files.
475475

0 commit comments

Comments
 (0)