Skip to content

Commit

Permalink
Added Shellcheck script and CI config. Closes sstephenson#14. (ssteph…
Browse files Browse the repository at this point in the history
…enson#238)

Added Shellcheck script and CI config. Closes sstephenson#14.
  • Loading branch information
sublimino authored Jul 27, 2019
2 parents 3adff32 + 07bbad5 commit 1c83a1b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ matrix:
services:
- docker

before_script:
- |
if [[ "${TRAVIS_OS_NAME:-}" == 'linux' ]]; then
sudo apt-get install shellcheck
fi
script:
- |
if [[ "${TRAVIS_OS_NAME:-}" == 'linux' ]]; then
# @todo: Remove "|| true" once all coding standards issues are fixed.
./shellcheck.sh || true
fi
if [[ "${TRAVIS_OS_NAME:-}" == 'linux' && -n "${BASHVER}" ]]; then
docker build --build-arg bashver="${BASHVER}" --tag "bats/bats:bash-${BASHVER}" . &&
docker run -it "bash:${BASHVER}" --version &&
Expand Down
19 changes: 19 additions & 0 deletions shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -e

targets=()
while IFS= read -r -d $'\0'; do
targets+=("$REPLY")
done < <(
find \
bin/bats \
libexec/bats-core \
shellcheck.sh \
-type f \
-print0
)

for file in "${targets[@]}"; do
[ -f "${file}" ] && LC_ALL=C.UTF-8 shellcheck "${file}"
done;

0 comments on commit 1c83a1b

Please sign in to comment.