Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Case Study: A Free Model Wrote a C++ TODO Expiry Checker

Описание и применение

Кейс-стади о создании инструмента на C++17 для проверки истекших TODO-комментариев. Автор использовал AI-модель MonkeyCode, пройдя три итерации: от компилирующегося, но логически неверного кода до решения, учитывающего строковые литералы и невалидные даты. Ключевой вывод: успешная компиляция не гарантирует корректность работы.

Задача

TODO comments in codebases accumulate without dates or owners, becoming technical debt. There is a need for a tool to scan C++ repositories, extract ISO dates from TODO/FIXME comments, and fail CI builds if deadlines have passed, while correctly ignoring string literals and handling invalid dates.

Результат

After three iterations, a C++17 tool was successfully created that accurately identifies expired TODOs while ignoring false positives in string literals and handling invalid dates. The key lesson was that compilation success does not guarantee logical correctness, and AI models may default to newer language standards (C++20) unless constrained.

Рабочий процесс

  • Define the problem: Scan .cpp/.hpp/.h/.cc files for TODO/FIXME with ISO dates.
  • Create a test fixture: 23 source files with 47 tokens including expired, active, undated, string-literal, block-comment, and malformed date cases.
  • Round 1: Generate code with AI. Result: Compiled but failed fixture (false positives in strings, accepted invalid dates).
  • Round 2: Fix string literal issue. Result: Failed compilation due to C++20 dependencies in C++17 project.
  • Round 3: Implement C++17-compatible date logic (days_from_civil) and a state machine for parsing. Result: Passed fixture.
  • Integrate tool into CI to fail builds on expired TODOs.

Доказательства

The first draft compiled on the first try. That was the only thing it did correctly.

Источник

The second draft... used std::chrono::year_month_day... which are C++20 types. The project toolchain is C++17.

Источник

  • Дата записи: 2026-09-05T18:29:50.121Z