Skip to content

Commit

Permalink
ci/cd: add check for TODO comments
Browse files Browse the repository at this point in the history
This commit introduces a new GitHub Actions job within the quality
checks workflow that scans the latest commit for TODO comments. The
intention is to prevent such comments from being merged into the main
branch, promoting cleaner and more maintainable code.

The script uses a specific pattern to avoid IDE detection and
misclassification of the script line as a TODO item itself. If any TODO
comments are found, the script exists with a non-zero status,
indicating an issue that must be addressed before proceeding.
  • Loading branch information
undergroundwires committed Apr 24, 2024
1 parent 8b224ee commit 4e21f05
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/checks.quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,22 @@ jobs:
-
name: Lint
run: ${{ matrix.lint-command }}

todo-check:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Scan latest commit for TODO comments
shell: bash
run: |-
readonly todo_comment_search_pattern='TODO'':' # Define search pattern in parts to prevent IDE from flagging this script line as a TODO item
if git grep "$todo_comment_search_pattern" HEAD; then
echo 'TODO comments found in the latest commit.'
exit 1
else
echo 'No TODO comments found in the latest commit.'
exit 0
fi

0 comments on commit 4e21f05

Please sign in to comment.