mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 20:31:48 +00:00
Closes https://github.com/sourcegraph/sourcegraph/issues/54829 Next steps: - what safeguards will we have in place for when we remove this from `sg lint` - should we remove it from `sg lint`, its likely not contributing much overhead even in the uncommon case of shell files being touched _How did some of these violations get in when theres shell lints :clueless:_ ## Test plan `pre-commit run --hook-stage=pre-push shellcheck shfmt`
30 lines
610 B
Bash
Executable File
30 lines
610 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
create_annotation() {
|
|
code=$1
|
|
file=$2
|
|
|
|
if [ "$code" -eq 0 ]; then
|
|
return
|
|
fi
|
|
slurp=$(cat "$file")
|
|
printf "\`\`\`\n%s\n\`\`\`\n" "$slurp" >"$(dirname "${BASH_SOURCE[0]}")/../../annotations/Job log.md"
|
|
}
|
|
|
|
log_file=$(mktemp)
|
|
# shellcheck disable=SC2064
|
|
trap "rm -rf $log_file" EXIT
|
|
|
|
# Remove parallel citation log spam.
|
|
echo 'will cite' | parallel --citation &>/dev/null
|
|
|
|
parallel --jobs 4 --memfree 500M --keep-order --line-buffer --joblog "$log_file" -v "$@"
|
|
code=$?
|
|
|
|
echo "--- done - displaying job log:"
|
|
cat "$log_file"
|
|
|
|
create_annotation "$code" "$log_file"
|
|
|
|
exit "$code"
|