diff options
Diffstat (limited to 'linters/lint-notes/check.sh')
-rw-r--r-- | linters/lint-notes/check.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/linters/lint-notes/check.sh b/linters/lint-notes/check.sh new file mode 100644 index 0000000000..cd87900f9b --- /dev/null +++ b/linters/lint-notes/check.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +set -e + +CABAL_INSTALL="${CABAL_INSTALL:-cabal}" +GHC="${GHC:-ghc}" + +cd "$(dirname $0)" +"$CABAL_INSTALL" build -w "$GHC" +bin="$("$CABAL_INSTALL" list-bin -w "$GHC" lint-notes)" +cd "$(git rev-parse --show-toplevel)" +"$bin" broken-refs \ + | grep -v "linters/lint-notes/expected-broken-note-refs:" \ + | sed 's/:[0-9]\+:[0-9]\+:/:/' \ + > broken-note-refs + +if diff -q linters/lint-notes/expected-broken-note-refs broken-note-refs; then + printf "No unexpected broken note references" +else + printf "Found unexpected broken note references:\n\n" + diff -u linters/lint-notes/expected-broken-note-refs broken-note-refs || true + if [[ "$1" == "-a" ]]; then + cp broken-note-refs linters/lint-notes/expected-broken-note-refs + printf "\n" + printf "Accepted new broken note references." + else + exit 1 + fi +fi + |