An open API service indexing awesome lists of open source software.

https://github.com/lig/todo-md

`todo-md` is a small pre-commit hook implemented in Bash that maintains `TODO.md` file in your repo
https://github.com/lig/todo-md

devtools pre-commit pre-commit-hook todo

Last synced: 3 months ago
JSON representation

`todo-md` is a small pre-commit hook implemented in Bash that maintains `TODO.md` file in your repo

Awesome Lists containing this project

README

        

# TODO.md Pre-Commit Hook

`todo-md` is a pre-commit hook written in Go that automatically maintains a `TODO.md` file in your repository. It collects `TODO:` comments from your code and organizes them into a markdown file, making it easy to track tasks and improvements.

## Features

- Automatically scans your staged files for `TODO:` comments.
- Updates `TODO.md` with references to the files, line numbers, and corresponding comments.
- Removes outdated entries from `TODO.md` when tasks are removed from the code.
- Uses Forge (e.g. Codeberg or GitHub) style `#L` links that work in a Forge UI.
- Uses IDE style `:` text for links that are being recognized in terminal output by most of IDEs.

## Usage

### Installation

1. Install [pre-commit](https://pre-commit.com/).

2. Add the following to your `.pre-commit-config.yaml`:

```yaml
repos:
- repo: https://codeberg.org/lig/todo-md.git
rev: v2.0.3
hooks:
- id: todo-md
```

3. Install the hook by running:

```bash
pre-commit install
```

### How It Works

- The hook scans all staged files for lines containing `TODO:` comments.
- For each `TODO:` comment, it extracts:
- The file name
- The line number
- The comment text
- It updates `TODO.md` in the root of the repository with entries in the format:

```markdown
* [path/to/file:](path/to/file#L): The TODO comment text
```

- Outdated entries (corresponding to removed `TODO:` comments) are removed automatically.

### Example

Given the following code in a staged file:

```python
...
# TODO: Refactor this function
def example():
pass
```

`TODO.md` will be updated as:

```markdown
* [path/to/file:2](path/to/file#L2): Refactor this function
```

See a [list of forks of popular projects](#examples-of-todo-md-generated-for-some-open-source-projects) with `TODO.md` file generated using this hook. :)

## Contributing

Contributions are welcome! Feel free to submit issues or pull requests to the project repository: [todo-md on Codeberg](https://codeberg.org/lig/todo-md).

## Support & Community

Feel free to ask a question or request a feature in [Issues](https://codeberg.org/lig/todo-md/issues) or join our [chat on Matrix](https://matrix.to/#/#todomd:dabar.chat).

## License

This project is licensed under the [MIT License](LICENSE).

## Examples of TODO.md generated for some Open Source Projects

- [CPython](https://github.com/lig/cpython/blob/master/TODO.md) (187 TODOs)
- [Linux](https://github.com/lig/linux/blob/master/TODO.md) (3788 TODOs)
- [Git](https://github.com/lig/git/blob/master/TODO.md) (112 TODOs)
- [Go](https://github.com/lig/go/blob/master/TODO.md) (455 TODOs)