bin/shellcheck-all was missing some files (#5335)

* bin/shellcheck-all was missing some files

`bin/shellcheck-all` identifies what files to check by filtering by the
`text/x-shellscript` mime-type, which only applies to files with a
shebang pointing to bash. We had a number of files with a
`#!/usr/bin/env sh` shebang that (at least in Ubuntu given `sh` points
to `dash`) only exposes a `text/plain` mime-type, thus they were not
being checked.

This fixes that issue by replacing the filter in `bin/shellcheck-all`, using a simple grep over the file shebang instead of using the `file` command.
This commit is contained in:
Alejandro Pedraza 2020-12-08 09:30:52 -05:00 committed by GitHub
parent d2dc87a0bc
commit 48666a7673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 10 deletions

View File

@ -22,6 +22,6 @@ rootdir=$( cd "$bindir"/.. && pwd )
GO111MODULE=on go generate -mod=readonly ./jaeger/static
GO111MODULE=on go generate -mod=readonly ./multicluster/static
root_tag=$("$bindir"/root-tag)
GO111MODULE=on CGO_ENABLED=0 go build -o $target -tags prod -mod=readonly -ldflags "-s -w -X github.com/linkerd/linkerd2/pkg/version.Version=$root_tag" ./cli
GO111MODULE=on CGO_ENABLED=0 go build -o "$target" -tags prod -mod=readonly -ldflags "-s -w -X github.com/linkerd/linkerd2/pkg/version.Version=$root_tag" ./cli
echo "$target"
)

View File

@ -6,10 +6,10 @@ bin/helm-docs
dir_dirty=$(git diff HEAD)
if [ -z "$dir_dirty" ]; then
echo "Helm-docs generated readmes match chart readmes."
echo 'Helm-docs generated readmes match chart readmes.'
exit 0
else
echo "Helm-docs generated readmes diverge from current chart readmes:"
echo "$(git status)"
echo 'Helm-docs generated readmes diverge from current chart readmes:'
git status
exit 64
fi

View File

@ -13,10 +13,10 @@ bin/protoc-go.sh
dir_dirty=$(git diff HEAD)
if [ -z "$dir_dirty" ]; then
echo "Protobuf definitions match generated code"
echo 'Protobuf definitions match generated code'
exit 0
else
echo "Protobuf definitions diverge from generated code:"
echo "$(git status)"
echo 'Protobuf definitions diverge from generated code:'
git status
exit 64
fi

View File

@ -10,6 +10,4 @@ rootdir=$( cd "$bindir"/.. && pwd )
# We want the word splitting for the shellcheck arguments
# shellcheck disable=SC2046
"$bindir"/shellcheck -x -P "$bindir" $(find "$rootdir" -type f \
! -path "$rootdir"/.git/hooks/\*.sample \
| while read -r f; do [ "$(file -b --mime-type "$f")" = 'text/x-shellscript' ] && printf '%s\0' "$f"; done | xargs -0)
"$bindir"/shellcheck -x -P "$bindir" $(grep -rnsle '^#!/usr/bin/env \(bash\|sh\)' "$rootdir"/* | xargs)