I had some TODO and FIXME instructions in random locations in my code that served no purpose, as I was never looking for them. I also use "console.log" for temporary debug logs that should be removed in production.
I sometimes forget some console.log statements, and basically always ignore the TODO/FIXME comments.
So i made a very simple script that fails if there are TODOs, FIXMEs or console.log in your code. This way the PR won't look like it's passing if it's missing an important part.
Save it in .github/workflows/check_todos.yml
name: Look for todos and fixmes
on:
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
if grep --exclude-dir={.git,.github} -rE "TODO|FIXME|console\.log"; then
exit 1
else
echo "All good"
fi
I exclude .git because it could contain the text. And I exclude .github so that the regex doesn't match itself. Package files should not be a problem as the script doesn't pull any external dependencies (no npm install)
The search is case sensitive, so it will only trip for clear TODOs and not some random method names.
You get the results really quickly, and because only the source is checked out ,all the generated files/packages should be excluded from the search.