# forgejo-todo-checker Checks your source files for TODO and FIXME comments, failing your build where they don't have an open issue number. - [A ForgeJo Action](https://forgejo.org/docs/next/user/actions/). (Inspired by https://woodpecker-ci.org/plugins/TODO-Checker) ## Codeberg Mirror Main development takes place on [git.kemitix.net](https://git.kemitix.net/kemitix/forgejo-todo-checker). There is a mirror on Codeberg.org as [kemitix/todo-checker](https://codeberg.org/kemitix/todo-checker). This mirror allows you to refer to the action as simply `kemitix/todo-checker@v1.0.0`. ## Usage ```yaml jobs: tests: steps: - name: Checkout uses: actions/checkout@v4 - name: Check TODOs # Original: # uses: https://git.kemitix.net/kemitix/forgejo-todo-checker@v1.0.0 # Codeberg mirror: uses: kemitix/todo-checker@v1.0.0 ``` ## Comments Format This Action looks for comments in the following formats: ``` // TODO: (#19) This is the comment // FIXME (#29) This is the other comment # TODO (#19) This is the comment # FIXME: (#29) This is the other comment ``` These are all considered valid comments. Pick the format that fits your language or file best. Comments are found by matching them against this regular expression: `(#|//)\s*(TODO|FIXME)` i.e.: be a comment by starting with either '#' or '//', then the word `TODO` or `FIXME` in all caps. Once we have a line with such a comment we look for the Issue Number with: `\(#?(?P\d+)\)` i.e.: a number in `()`, with or without a leading `#` (inside the braces). The `ISSUE_NUMBER` must correspond to an **OPEN** Issue in the repo that the Action is running against. If the issue has been closed or can't be found then the comment is marked as an error and the Check with fail. ## Example Output The output will be similar to the following if there are any errors: ``` Forgejo TODO Checker! Repo: kemitix/my-project Prefix: (#|//)\s*(TODO|FIXME) Issues: \(#?(?P\d+)\) - Issue number missing: src/main.rs#38: // TODO: implement this cool feature and get rich! >> 1 error in src/main.rs - Closed/Invalid Issue: (19) src/model/line.rs#12: // TODO: (#19) This is the comment >> 1 error in src/model/line.rs Error: Invalid or closed TODO/FIXMEs found ``` The first error is because there is no issue number associated with the TODO comment. The second error is because the issue has already been closed. ## License `forgejo-todo-checker` is released under the MIT License.