Skip to content

Check your code TODOs (and fail your ci/cd if they're overdue)

License

Notifications You must be signed in to change notification settings

aliadnani/todo-ci

Repository files navigation

todo-ci

Check for TODOs in code with deadlines

Quick Start

Write your todos in the format: @todo(YYYY-MM-DD): A description of a todo...

fn main() {
    // @todo(2022-08-10): Print something besides "Hello World!"
    println!("Hello World!");
}

Run todo-ci <directory> to check for overdue TODOs in the specified directory

# Local installation
todo-ci ./

# Docker
docker run -v $(pwd):/volume -it ghcr.io/aliadnani/todo-ci:latest /volume

todo-ci

Use Case

Run todo-ci as part of your ci/cd runs to check for any outstanding TODOs in code. If any are found, a 1 exit code is emitted, hence failing the run.

todo-ci is similar to todo-or-die & todo-macro but without the use of Rust macros and instead run as a separate CLI tool. This allows todo-ci to be language agnostic and lets you run it in any project using a language that supports comments.

Installation

Using cargo:

cargo install todo-ci

Using docker:

# Pull the latest image
# See https://github.com/aliadnani/todo-ci/pkgs/container/todo-ci
docker pull ghcr.io/aliadnani/todo-ci:latest

Tips

  1. Set the --no-error flag on production ci/cd runs to prevent non-deterministic builds if any TODOs do expire.
  2. A .tdignore file can be added at the directory todo-ci is invoked in, this disables TODO checking for specified files/directories.
  3. Set a --timezone-offset corresponding to your team's timezone (e.g. +08:00) to make the TODO expiry check more correct - otherwise it defaults to UTC

Features

Options:
  -n, --no-ignore
          For disabling ignored files by default (.gitignore, hidden files, etc.)
  -e, --no-error
          For disabling returning system error code (1) if there are overdue todos
  -d, --display-mode <DISPLAY_MODE>
          Display mode:
           - concise: total number of valid + overdue todos
           - overdue-only: total number of valid + overdue todos + details of overdue todos
           - default: total number of valid + overdue todos + details of all todos
           [default: default] [possible values: concise, overdue-only, default]
  -p, --pattern <IGNORE_PATTERN>
          Pattern to check `todos` for (i.e. `*.rs` , `main.*`, etc.) [default: *]
  -t, --timezone-offset <TIMEZONE_OFFSET>
          Timezone to use for date checking [default: +00:00]
  -h, --help
          Print help information
  -V, --version
          Print version information

About

Check your code TODOs (and fail your ci/cd if they're overdue)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages