From 866b3f0fe757ede0976cb360d1061982d8fef392 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sat, 28 Feb 2026 00:23:35 -0500 Subject: [PATCH] type hint scanner --- scripts/type_hint_scanner.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/type_hint_scanner.py diff --git a/scripts/type_hint_scanner.py b/scripts/type_hint_scanner.py new file mode 100644 index 0000000..4c0bfff --- /dev/null +++ b/scripts/type_hint_scanner.py @@ -0,0 +1,24 @@ +import ast +import sys + +def get_missing_hints(file_path: str): + with open(file_path, "r", encoding="utf-8") as f: + tree = ast.parse(f.read()) + + missing = [] + for node in ast.walk(tree): + if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)): + has_return = node.returns is not None + args_missing = any(arg.annotation is None for arg in node.args.args if arg.arg != "self") + if not has_return or args_missing: + missing.append({ + "name": node.name, + "lineno": node.lineno, + "col_offset": node.col_offset + }) + return missing + +if __name__ == "__main__": + if len(sys.argv) > 1: + for m in get_missing_hints(sys.argv[1]): + print(f"Line {m['lineno']}: {m['name']}")