Add shellcheck as a linter.

Fixes #10162.

Tweaked by tabbott to cover documentation as well.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
Anders Kaseorg
2018-08-02 20:09:42 -04:00
committed by Tim Abbott
parent d0fb34e8af
commit c3bd293eaf
6 changed files with 32 additions and 3 deletions

14
scripts/lib/install-shellcheck Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -eu
version=0.5.0
if ! out="$(shellcheck --version 2>/dev/null)" || [[ "$out" != *"
version: $version
"* ]]; then
tmpdir="$(mktemp -d)"
trap 'rm -r "$tmpdir"' EXIT
cd "$tmpdir"
wget -nv "https://storage.googleapis.com/shellcheck/shellcheck-v$version.linux.x86_64.tar.xz"
tar -xJf "shellcheck-v$version.linux.x86_64.tar.xz" --no-same-owner --strip-components=1 -C /usr/local/bin "shellcheck-v$version/shellcheck"
fi