BigW Consortium Gitlab

lint-doc.sh 704 Bytes
Newer Older
1 2 3 4 5
#!/usr/bin/env bash

cd "$(dirname "$0")/.."

# Use long options (e.g. --header instead of -H) for curl examples in documentation.
6
grep --extended-regexp --recursive --color=auto 'curl (.+ )?-[^- ].*' doc/
7 8 9 10 11 12
if [ $? == 0 ]
then
  echo '✖ ERROR: Short options should not be used in documentation!' >&2
  exit 1
fi

13 14
# Ensure that the CHANGELOG.md does not contain duplicate versions
DUPLICATE_CHANGELOG_VERSIONS=$(grep --extended-regexp '^## .+' CHANGELOG.md | sed -E 's| \(.+\)||' | sort -r | uniq -d)
15 16
if [ "${DUPLICATE_CHANGELOG_VERSIONS}" != "" ]
then
17
  echo '✖ ERROR: Duplicate versions in CHANGELOG.md:' >&2
18 19 20 21
  echo "${DUPLICATE_CHANGELOG_VERSIONS}" >&2
  exit 1
fi

22 23
echo "✔ Linting passed"
exit 0