Skip to content

Commit

Permalink
docs: Update README (#710)
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Lewis <ianmlewis@gmail.com>
  • Loading branch information
Ian Lewis authored Sep 22, 2023
1 parent 125f23c commit 0832830
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/ianlewis/todos/badge)](https://api.securityscorecards.dev/projects/github.com/ianlewis/todos)
[![SLSA 3](https://slsa.dev/images/gh-badge-level3.svg)](https://slsa.dev)

Tools for dealing with TODOs in code.
Parse out TODOs, FIXMEs, BUGs and HACKs from your code.

<p align="center"><img src="img/todos.png?raw=true"/></p>

This repo contains the following tools for dealing with TODOs in code.

- [`todos` CLI]: searches for TODO comments in code and prints them in various
formats.
Expand All @@ -16,18 +20,18 @@ Tools for dealing with TODOs in code.

See the [FAQ] for more info on the philosophy behind the project.

## TODO comments
## TODO comment format

"TODO" comments are comments in code that mark a task that is intended to be
done in the future.

For example:

```go
// TODO: Update this code.
// TODO(some label or reference): Update this code.
```

### TODO comment variants
### TODO comment type variants

There a few veriants of this type of comment thare are in wide use.

Expand All @@ -40,9 +44,9 @@ There a few veriants of this type of comment thare are in wide use.
- **XXX**: Danger! Similar to "HACK". Modifying this code is dangerous. It
- **COMBAK**: Something you should "come back" to.

### TODO comment formats
### TODO comment examples

There are a few ways to format a TODO comment with metadata.
TODO comments can include some optional metadata. Here are some examples:

- A naked TODO comment.

Expand Down Expand Up @@ -83,13 +87,21 @@ main.go:27:// TODO(#123): Return a proper exit code.
main.go:28:// TODO(ianlewis): Implement the main method.
```
In order for the comments to be more easily parsed keep in mind the following:
- Spaces between the comment start and 'TODO' is optional (e.g. `//TODO: some comment`)
- TODOs should have a colon if a message is present so it can be distingished
from normal comments.
- Comments can be on the same line with other code (e.g. `x = f() // TODO: call f`
- Only the single line where the TODO occurs is printed for multi-line comments.
- `TODO`,`FIXME`,`BUG`,`HACK`,`XXX`,`COMBAK` are supported by default. You can
change this with the `--todo-types` flag.
## `todos` CLI tool
The `todos` CLI scans files in a directory and prints any "TODO" comments it
finds in various formats.
<p align="center"><img src="img/todos.png?raw=true"/></p>
### Install `todos`
There are two methods for installing `todos`.
Expand Down Expand Up @@ -242,6 +254,12 @@ kubernetes$ # Get all the unique files with TODOs that Tim Hockin owns.
kubernetes$ todos -o json | jq -r '. | select(.label = "thockin") | .path' | uniq
```
## Related projects
- [pgilad/leasot](https://github.com/pgilad/leasot): A fairly robust tool with good integration with the Node.js ecosystem.
- [judepereira/checktodo](https://github.com/judepereira/checktodo): A GitHub PR checker that checks if PRs contain TODOs.
- [kynikos/report-todo](https://github.com/kynikos/report-todo): A generic reporting tool for TODOs.
## FAQ
### Why use this?
Expand Down

0 comments on commit 0832830

Please # to comment.