#!/bin/bash# Template generated by https://github.com/coreos/repo-templates; do not edit downstreamset -euo pipefailmain() {local found_errors="false"# Let's start with error, then we can do warning, info, stylelocal -r severity="error"while IFS= read -r -d '' f; do# Skip non-text files that are very unlikely to be shell scriptsif [[ "$(file -b --mime-type "${f}" | sed 's|/.*||')" != "text" ]]; thencontinuefishebang="$(head -1 "${f}")"if [[ "${f}" == *.sh ]] || \[[ ${shebang} =~ ^#!/.*/bash.* ]] || \[[ ${shebang} =~ ^#!/.*/env\ bash ]]; thenecho "[+] Checking ${f}"shellcheck --external-sources --shell bash --severity="${severity}" "${f}" || found_errors="true"bash -n "${f}" || found_errors="true"fidone< <(find . -path "./.git" -prune -o -path "./vendor" -prune -o -type f -print0)if [[ "${found_errors}" != "false" ]]; thenecho "[+] Found errors with ShellCheck"exit 1fiecho "[+] No error found with ShellCheck"exit 0}main "${@}"