Checks your source files for TODO and FIXME comments, where they don't have an open issue number. (Inspired by https://woodpecker-ci.org/plugins/TODO-Checker)
Find a file
Renovate Bot 14cf977369
All checks were successful
Test / build (map[name:nightly]) (pull_request) Successful in 6m52s
Test / build (map[name:stable]) (pull_request) Successful in 4m25s
Test / build (map[name:nightly]) (push) Successful in 3m6s
Test / build (map[name:stable]) (push) Successful in 5m0s
chore(deps): update kemitix/rust action to v2.5.0
2024-12-02 23:00:48 +00:00
.forgejo/workflows chore(deps): update kemitix/rust action to v2.5.0 2024-12-02 23:00:48 +00:00
src build: mark untestable function to be excluded from mutation tests 2024-11-28 17:39:06 +00:00
.gitignore build: add build steps as default recipe in justfile 2024-11-14 20:32:46 +00:00
.ignore build: don't check README for TODO/FIXME comments 2024-09-20 21:50:05 +01:00
Cargo.toml chore: release v1.2.0 2024-11-28 18:39:26 +00:00
CHANGELOG.md chore: release v1.2.0 2024-11-28 18:39:26 +00:00
cliff.toml build: add prep-release recipe to justfile 2024-09-22 14:50:11 +01:00
Dockerfile chore(deps): update docker.io/rust docker tag to v1.83.0 2024-12-02 21:45:38 +00:00
justfile build: add build steps as default recipe in justfile 2024-11-14 20:32:46 +00:00
LICENSE Initial commit 2024-09-17 15:35:04 +01:00
README.md docs(readme): fix typo about where mirror is hosted 2024-11-13 09:17:36 +00:00
renovate.json build(renovate): ignore alias kemitix/todo-checker 2024-09-22 20:05:06 +01:00

forgejo-todo-checker

Checks your source files for TODO and FIXME comments, failing your build where they don't have an open issue number.

(Inspired by https://woodpecker-ci.org/plugins/TODO-Checker)

LATEST version

See Releases for the latest version. Replace ${LATEST} in the examples below with the tag version (include any leading v).

code.forgejo.org Mirror

Main development takes place on git.kemitix.net.

There is a mirror on code.forgejo.org as kemitix/todo-checker.

This mirror allows you to refer to the action as simply kemitix/todo-checker@${LATEST}.

Usage

jobs:
  tests:
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Check TODOs
        # Original:
        # uses: https://git.kemitix.net/kemitix/forgejo-todo-checker@${LATEST}
        # Codeberg mirror:
        uses: kemitix/todo-checker@${LATEST}

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, with or without a trailing ':'.

Once we have a line with such a comment we look for the Issue Number with: \(#?(?P<ISSUE_NUMBER>\d+)\)

i.e.: a number in '()', with or without a leading '#' (inside the braces) immediately after the 'TODO' or 'FIXME'.

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
Regex: (#|//)\s*(TODO|FIXME):?\s*\(#?(?P<ISSUE_NUMBER>\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.