Developer builds AST-based CLI tool to catch outdated code examples in README files
A developer has released doc-drift, an open-source command-line tool designed to detect discrepancies between code examples in Markdown documentation and the actual codebase. The tool scans fenced code blocks in Markdown files, parses them using Python's built-in Abstract Syntax Tree module, and checks whether documented function signatures still match the real code. Unlike AI-based alternatives, doc-drift is fully deterministic, read-only, and requires no external dependencies beyond Python 3.11 or later. It flags three types of issues: signature drift, missing functions or classes, and unparseable blocks, while deliberately allowing argument omissions to minimize false positives. In a test against a large open-source repository with over 1,600 Markdown files, the tool identified one genuine drift case without generating excessive noise.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in