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.
This commit is contained in:
19
.github/workflows/checks.quality.yaml
vendored
19
.github/workflows/checks.quality.yaml
vendored
@@ -28,3 +28,22 @@ jobs:
|
|||||||
-
|
-
|
||||||
name: Lint
|
name: Lint
|
||||||
run: ${{ matrix.lint-command }}
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user