Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your README code examples are silently lying — I built a CLI to detect documentation drift using only AST, no LLM

Your README code examples are silently lying — I built a CLI to detect documentation drift using only AST, no LLM "Did you know? This README example doesn't work." Have you ever had a junior engineer tell you that? Or worse — have you added a line to your code, forgot the docs, and broke it yourself ? This time I want to tell you about doc-drift , a CLI I built that detects this "documentation…

Your README code examples aren't always accurate, and I've built a command-line tool to detect documentation drift using only Abstract Syntax Trees (AST), without relying on Large Language Models (LLMs). This tool, named doc-drift, is available at https://github.com/sunnydachs/doc-drift.

Doc-drift scans your repository for Markdown files with fenced code blocks, extracts the defined functions and classes, and compares them to the actual codebase. It reports three main findings: SIGNATURE DRIFT (the documented function exists, but its arguments have changed), MISSING (the documented function/class no longer exists in the repository), and UNPARSEABLE (the block isn't valid Python code). The tool is designed to be deterministic, safe, and read-only, with no dependencies beyond Python 3.11+.

The author emphasizes that the tool is meant to catch issues that other tools, like IDEs and static analysis, cannot. This includes scenarios where code examples in docs are simplified versions of the actual codebase. The tool is currently limited to Python, but the author plans to expand support for other languages in the future.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

DIVING DEEPER INTO POWER BI

Introduction If you’ve ever packed a backpack for a long trip, you know that just throwing everything into one giant pocket makes a total mess.

  • Power BI is Microsoft's analytics and visualization platform
  • Connect, Transform, Model, and Visualize are Power BI's four functions
  • Fact and dimension tables separate data for efficient retrieval

Software Artifact Trust Starts At Package Registries

Which software artifact should we trust? Software package registries are open to the public, they essentially allow anyone really to share there libraries and code.

  • Software registries like PyPI enable code sharing but pose security risks.
  • Tool Baro helps inspect package metadata and provenance before download.
  • Pinning SHA hashes ensures package integrity and enhances open source security.

More from Wednesday 16 September →