Skip to content

Commit b784d71

Browse files
committed
fix: Only check for TODO/mock in comments, not strings
The previous check flagged TODO/mock anywhere in Python scripts, including legitimate uses in: - String literals (error messages, docstrings) - Code that checks for TODOs (like code review scripts) Updated all three checks to only flag patterns in actual comment lines (starting with #): - TODO detection: ^\s*#.*\bTODO\b - Stub detection: ^\s*#.*(stub patterns) - Mock detection: ^\s*#.*\bmock\b.*\bimplementation\b This eliminates false positives while preserving detection of incomplete work marked in comments.
1 parent 7bb21ea commit b784d71

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/validate-resources.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ jobs:
155155
found=0
156156
157157
while IFS= read -r script; do
158-
if grep -qi '\bTODO\b' "$script"; then
158+
# Only flag TODO in actual comments (starting with #), not in strings or code
159+
if grep -qiE '^\s*#.*\bTODO\b' "$script"; then
159160
echo "⚠️ $script: Contains TODO comments"
160161
((found++))
161162
fi
@@ -164,7 +165,8 @@ jobs:
164165
echo "⚠️ $script: Contains stub implementation references"
165166
((found++))
166167
fi
167-
if grep -qiE '\bmock\b.*\bimplementation\b' "$script"; then
168+
# Only flag mock implementation in comments
169+
if grep -qiE '^\s*#.*\bmock\b.*\bimplementation\b' "$script"; then
168170
echo "⚠️ $script: May contain mock implementation"
169171
((found++))
170172
fi

0 commit comments

Comments
 (0)