Files
swupd-client/test/code_analysis/shellcheck-all.bats
T
Otavio Pontes 4eab2e54ad shellcheck: Don't stop shellcheck-all script on first error
This is script is very slow, so it's better to gather all information
before aborting.

Also improve the output of the test when an error happens
2020-03-19 09:53:39 -07:00

28 lines
550 B
Bash
Executable File

#!/usr/bin/env bats
# Author: Otavio Pontes
# Email: otavio.pontes@intel.com
@test "ANL002: Shellcheck on all files" {
local error=0
status=0
output=""
TESTS=$(find . -regex ".*\\.bats\\|.*\\.bash" | sort)
for i in $TESTS; do
echo checking "$i" >&3
run sh -c "sed 's/^@.*/func() {/' $i |
sed 's/^load.*/source test\/functional\/testlib.bash/' |
shellcheck -s bash -x -e SC1008 /dev/stdin"
echo "Result: $status" >&3
if [ ! "$status" -eq "0" ]; then
echo "$output" >&3
error=1
fi
echo >&3
done
[ "$error" -eq "0" ]
}