diff options
author | Karl-Johan Alm <karljohan-alm@garage.co.jp> | 2019-08-01 18:06:58 +0900 |
---|---|---|
committer | Karl-Johan Alm <karljohan-alm@garage.co.jp> | 2019-08-06 16:46:20 +0900 |
commit | 6129830a330c9c53a918c671dce24a49b3921396 (patch) | |
tree | 530fb2a41ace2abe72bdcc7d73069b88ab53e428 | |
parent | a2645cdc421d13842f4ea180338264942330abff (diff) | |
download | bips-6129830a330c9c53a918c671dce24a49b3921396.tar.xz |
travis: add a check for common mistake mediawiki links
Several BIPs have mistaken links in format [text](url) which this travis check will detect and complain about.
-rw-r--r-- | .travis.yml | 1 | ||||
-rwxr-xr-x | scripts/link-format-chk.sh | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/.travis.yml b/.travis.yml index ed99de0..e463ab6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ os: linux language: generic sudo: false script: + - scripts/link-format-chk.sh - scripts/buildtable.pl >/tmp/table.mediawiki || exit 1 - diff README.mediawiki /tmp/table.mediawiki | grep '^[<>] |' >/tmp/after.diff || true - if git checkout HEAD^ && scripts/buildtable.pl >/tmp/table.mediawiki 2>/dev/null; then diff README.mediawiki /tmp/table.mediawiki | grep '^[<>] |' >/tmp/before.diff || true; newdiff=$(diff -s /tmp/before.diff /tmp/after.diff -u | grep '^+'); if [ -n "$newdiff" ]; then echo "$newdiff"; exit 1; fi; else echo 'Cannot build previous commit table for comparison'; fi diff --git a/scripts/link-format-chk.sh b/scripts/link-format-chk.sh new file mode 100755 index 0000000..86f28be --- /dev/null +++ b/scripts/link-format-chk.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2019 The Bitcoin Core developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# +# Check wrong mediawiki link format + +ECODE=0 +FILES="" +for fname in $(git diff --name-only HEAD $(git merge-base HEAD master)); do + if [[ $fname == *.mediawiki ]]; then + GRES=$(grep -n '](' $fname) + if [ "$GRES" != "" ]; then + if [ $ECODE -eq 0 ]; then + >&2 echo "Github Mediawiki format writes link as [URL text], not as [text](url):" + fi + ECODE=1 + echo "- $fname:$GRES" + fi + fi +done +exit $ECODE |