diff --git a/validate/lint.sh b/validate/lint.sh index 7a0550f..1b47f67 100755 --- a/validate/lint.sh +++ b/validate/lint.sh @@ -11,8 +11,17 @@ errors=0 echo "=== Lint Scan ===" -has_python=$(find "$TARGET" -name "*.py" -not -path "*/.*" | head -1) -has_go=$(find "$TARGET" -name "*.go" -not -path "*/.*" | head -1) +# Probe for source files. Explicit prunes (rather than -not -path "*/.*") +# so that target paths under hidden ancestor dirs (e.g. a Claude Code +# worktree at .../.claude/worktrees//) still match real source. +# -print -quit instead of `| head -1` avoids SIGPIPE under `set -o pipefail`. +has_python=$(find "$TARGET" \ + \( -path '*/__pycache__' -o -path '*/.venv' -o -path '*/venv' \ + -o -path '*/.git' -o -path '*/node_modules' \) -prune \ + -o -name '*.py' -print -quit) +has_go=$(find "$TARGET" \ + \( -path '*/.git' -o -path '*/vendor' -o -path '*/node_modules' \) -prune \ + -o -name '*.go' -print -quit) if [ -z "$has_python" ] && [ -z "$has_go" ]; then printf "${YELLOW}!${NC} No Python or Go files found — skipping\n" diff --git a/validate/sast.sh b/validate/sast.sh index 8b3ce66..77758f5 100755 --- a/validate/sast.sh +++ b/validate/sast.sh @@ -16,8 +16,17 @@ if ! command -v semgrep &>/dev/null; then exit 2 fi -has_python=$(find "$TARGET" -name "*.py" -not -path "*/.*" | head -1) -has_go=$(find "$TARGET" -name "*.go" -not -path "*/.*" | head -1) +# Probe for source files. Explicit prunes (rather than -not -path "*/.*") +# so that target paths under hidden ancestor dirs (e.g. a Claude Code +# worktree at .../.claude/worktrees//) still match real source. +# -print -quit instead of `| head -1` avoids SIGPIPE under `set -o pipefail`. +has_python=$(find "$TARGET" \ + \( -path '*/__pycache__' -o -path '*/.venv' -o -path '*/venv' \ + -o -path '*/.git' -o -path '*/node_modules' \) -prune \ + -o -name '*.py' -print -quit) +has_go=$(find "$TARGET" \ + \( -path '*/.git' -o -path '*/vendor' -o -path '*/node_modules' \) -prune \ + -o -name '*.go' -print -quit) if [ -z "$has_python" ] && [ -z "$has_go" ]; then printf "${YELLOW}!${NC} No Python or Go files found — skipping\n"