1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-05 15:47:14 +01:00
Files
installer/hack/shellcheck.sh
W. Trevor King ef594e5016 hack/shellcheck: Set --workdir and ignore tests/smoke vendor
Setting --workdir and passing ${@} through means:

  $ ./hack/shellcheck.sh

will show any errors with relative paths that will still work outside
the container.  For example:

  ./tests/smoke/.build/external/go_sdk/src/syscall/mkall.sh:278:7: note: Expressions don't expand in single quotes, use double quotes for that. [SC2016]

instead of:

  /workdir/tests/smoke/.build/external/go_sdk/src/syscall/mkall.sh:278:7: note: Expressions don't expand in single quotes, use double quotes for that. [SC2016]

Adding prune rules for vendor and .build under tests/smoke avoids
complaining about that file and others over which are maintained
upstream or elsewhere.
2018-09-13 10:47:40 -07:00

19 lines
569 B
Bash
Executable File

#!/bin/sh
if [ "$IS_CONTAINER" != "" ]; then
TOP_DIR="${1:-.}"
find "${TOP_DIR}" \
-path "${TOP_DIR}/vendor" -prune \
-o -path "${TOP_DIR}/.build" -prune \
-o -path "${TOP_DIR}/tests/smoke/vendor" -prune \
-o -path "${TOP_DIR}/tests/smoke/.build" -prune \
-o -type f -name '*.sh' -exec shellcheck --format=gcc {} \+
else
podman run --rm \
--env IS_CONTAINER=TRUE \
--volume "${PWD}:/workdir:ro,z" \
--entrypoint sh \
--workdir /workdir \
quay.io/coreos/shellcheck-alpine:v0.5.0 \
/workdir/hack/shellcheck.sh "${@}"
fi;