Skip to content

Commit b9cd2d0

Browse files
sfowlclaude
andcommitted
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 <noreply@anthropic.com>
1 parent bb48252 commit b9cd2d0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

scripts/run-shellcheck.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export SC_JOBS
1515
test -n "$SC_TIMEOUT" || export SC_TIMEOUT=30
1616
test 0 -lt "$SC_TIMEOUT" || exit $?
1717

18-
# skip files containing Jinja2 template syntax ({{ }}, {% %}, {# #})
18+
# skip files containing Jinja2 template syntax ({{{ }}}, {% %}, {# #})
1919
test -n "$SC_SKIP_JINJA" || export SC_SKIP_JINJA=0
2020

2121
# directory for shellcheck results
@@ -79,7 +79,7 @@ filter_shell_scripts() {
7979
apply_exclusion() {
8080
while read -r i; do
8181
# skip Jinja2 templates if requested
82-
if [ "$SC_SKIP_JINJA" -eq 1 ] && grep -qE '\{\{|\{%|\{#' "$i" 2>/dev/null; then
82+
if [ "$SC_SKIP_JINJA" -eq 1 ] && grep -qP '\{\{\{|\{%|(?<!\$)\{#' "$i" 2>/dev/null; then
8383
continue
8484
fi
8585

0 commit comments

Comments
 (0)