From 4e21f05031d6cc90cda684bd598bec4735f8103b Mon Sep 17 00:00:00 2001 From: undergroundwires Date: Wed, 24 Apr 2024 23:59:55 +0200 Subject: [PATCH] ci/cd: add check for TODO comments 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. --- .github/workflows/checks.quality.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/checks.quality.yaml b/.github/workflows/checks.quality.yaml index ce38f852..d60ec8cd 100644 --- a/.github/workflows/checks.quality.yaml +++ b/.github/workflows/checks.quality.yaml @@ -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