2016-08-08 08:42:20 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
|
|
|
# Use long options (e.g. --header instead of -H) for curl examples in documentation.
|
2017-09-25 04:50:06 -04:00
|
|
|
echo 'Checking for curl short options...'
|
|
|
|
grep --extended-regexp --recursive --color=auto 'curl (.+ )?-[^- ].*' doc/ >/dev/null 2>&1
|
2016-08-08 08:42:20 -04:00
|
|
|
if [ $? == 0 ]
|
|
|
|
then
|
2017-09-25 04:50:06 -04:00
|
|
|
echo '✖ ERROR: Short options for curl should not be used in documentation!
|
|
|
|
Use long options (e.g., --header instead of -H):' >&2
|
|
|
|
grep --extended-regexp --recursive --color=auto 'curl (.+ )?-[^- ].*' doc/
|
2016-08-08 08:42:20 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-10-16 14:29:45 -04:00
|
|
|
# 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)
|
2017-09-25 04:50:06 -04:00
|
|
|
echo 'Checking for CHANGELOG.md duplicate entries...'
|
2016-08-25 16:48:17 -04:00
|
|
|
if [ "${DUPLICATE_CHANGELOG_VERSIONS}" != "" ]
|
|
|
|
then
|
2016-10-16 14:29:45 -04:00
|
|
|
echo '✖ ERROR: Duplicate versions in CHANGELOG.md:' >&2
|
2016-08-25 16:48:17 -04:00
|
|
|
echo "${DUPLICATE_CHANGELOG_VERSIONS}" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-09-25 04:50:06 -04:00
|
|
|
# Make sure no files in doc/ are executable
|
2017-09-25 04:59:25 -04:00
|
|
|
EXEC_PERM_COUNT=$(find doc/ app/ -type f -perm 755 | wc -l)
|
2017-09-25 04:50:06 -04:00
|
|
|
echo 'Checking for executable permissions...'
|
|
|
|
if [ "${EXEC_PERM_COUNT}" -ne 0 ]
|
|
|
|
then
|
|
|
|
echo '✖ ERROR: Executable permissions should not be used in documentation! Use `chmod 644` to the files in question:' >&2
|
2017-09-25 04:59:25 -04:00
|
|
|
find doc/ app/ -type f -perm 755
|
2017-09-25 04:50:06 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-08-08 08:42:20 -04:00
|
|
|
echo "✔ Linting passed"
|
|
|
|
exit 0
|