From 7ca44ccb51229ce3b2857f16b64297940e597322 Mon Sep 17 00:00:00 2001 From: Sam Fowler Date: Fri, 19 Jun 2026 11:14:55 +1000 Subject: [PATCH] fix(shellcheck): reduce false positives in SC_SKIP_JINJA detection Require triple braces ({{{) instead of double ({{) to avoid matching Go template syntax in docker/kubectl/oc format arguments. Use PCRE negative lookbehind to exclude bash ${#...} parameter expansion from triggering the {# Jinja2 comment pattern. Co-Authored-By: Claude Opus 4.6 --- scripts/run-shellcheck.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run-shellcheck.sh b/scripts/run-shellcheck.sh index 7b7beb4..fbc033f 100755 --- a/scripts/run-shellcheck.sh +++ b/scripts/run-shellcheck.sh @@ -15,7 +15,7 @@ export SC_JOBS test -n "$SC_TIMEOUT" || export SC_TIMEOUT=30 test 0 -lt "$SC_TIMEOUT" || exit $? -# skip files containing Jinja2 template syntax ({{ }}, {% %}, {# #}) +# skip files containing Jinja2 template syntax ({{{ }}}, {% %}, {# #}) test -n "$SC_SKIP_JINJA" || export SC_SKIP_JINJA=0 # directory for shellcheck results @@ -79,7 +79,7 @@ filter_shell_scripts() { apply_exclusion() { while read -r i; do # skip Jinja2 templates if requested - if [ "$SC_SKIP_JINJA" -eq 1 ] && grep -qE '\{\{|\{%|\{#' "$i" 2>/dev/null; then + if [ "$SC_SKIP_JINJA" -eq 1 ] && grep -qP '\{\{\{|\{%|(?/dev/null; then continue fi