Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/pr-require-checks.yml
Comment thread
kyle-sexton marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,8 @@ jobs:
with:
files: ${{ steps.changed_shell.outputs.files }}
rcfile: .shellcheckrc
# Plugin-owned guardrails git-hook copies, linted at their plugins/guardrails sources.
exclude: .githooks/guardrails/

- name: Aggregate hygiene results
if: always()
Expand Down
3 changes: 3 additions & 0 deletions scripts/check-affected.sh
Comment thread
kyle-sexton marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ declare -a md=() sh=() py=() shebang=() plugins=()
skill_touched=0
for f in ${changed[@]+"${changed[@]}"}; do
case "$f" in
# Plugin-owned guardrails git-hook copies, linted at their plugins/guardrails
# sources; the workflow's ShellCheck step excludes .githooks/guardrails/ too.
.githooks/guardrails/*.sh | .githooks/guardrails/*.bash) ;;
*.md) md+=("$f") ;;
*.sh | *.bash) sh+=("$f") ;;
*.py) py+=("$f") ;;
Expand Down
9 changes: 8 additions & 1 deletion scripts/check-affected.test.sh
Comment thread
kyle-sexton marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,14 @@ if grep -q -- --rcfile <<<"$(shellcheck --help 2>&1)"; then
run -- --uncommitted
check "--uncommitted lints a changed shell file with the repository's .shellcheckrc" \
'[[ $RC == 1 && $ERR == *"FAIL shellcheck"* && $ERR == *"SC2292"* && $ERR != *"unrecognized option"* ]]'
rm -f "$repo/.shellcheckrc" "$repo/lint-me.sh"
rm -f "$repo/lint-me.sh"
mkdir -p "$repo/.githooks/guardrails"
printf '#!/usr/bin/env bash\nif [ -n "${1:-}" ]; then echo hi; fi\n' >"$repo/.githooks/guardrails/copy.sh"
chmod +x "$repo/.githooks/guardrails/copy.sh"
run -- --uncommitted
check "--uncommitted leaves the plugin-owned .githooks/guardrails copies to the workflow's excluded lint" \
'[[ $RC == 0 && $ERR != *"FAIL shellcheck"* && $ERR == *"SKIP shellcheck (no changed shell)"* ]]'
rm -rf "$repo/.shellcheckrc" "$repo/.githooks"
else
ok "SKIP --uncommitted shellcheck case (no shellcheck with --rcfile here)"
fi
Expand Down
Loading