diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2017-09-25 10:50:06 +0200 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2017-09-25 10:50:06 +0200 |
commit | 6532c137a74a23f062be29770c84ec2ab8cf5116 (patch) | |
tree | 71d001d2f567cee2494ec52a40ed57fae9c7bb77 /scripts | |
parent | babc1d023ee1352bdcc0444a5575774bd693ffc8 (diff) | |
download | gitlab-ce-6532c137a74a23f062be29770c84ec2ab8cf5116.tar.gz |
Add check for exec permissions and refactor lint doc script
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/lint-doc.sh | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 54c1ef3dfdd..fffb727ac2f 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -3,15 +3,19 @@ cd "$(dirname "$0")/.." # Use long options (e.g. --header instead of -H) for curl examples in documentation. -grep --extended-regexp --recursive --color=auto 'curl (.+ )?-[^- ].*' doc/ +echo 'Checking for curl short options...' +grep --extended-regexp --recursive --color=auto 'curl (.+ )?-[^- ].*' doc/ >/dev/null 2>&1 if [ $? == 0 ] then - echo '✖ ERROR: Short options should not be used in documentation!' >&2 + 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/ exit 1 fi # 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) +echo 'Checking for CHANGELOG.md duplicate entries...' if [ "${DUPLICATE_CHANGELOG_VERSIONS}" != "" ] then echo '✖ ERROR: Duplicate versions in CHANGELOG.md:' >&2 @@ -19,5 +23,16 @@ then exit 1 fi +# Make sure no files in doc/ are executable +EXEC_PERM_COUNT=$(find doc/ -type f -perm 755 | wc -l) +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 + echo + find doc/ -type f -perm 755 + exit 1 +fi + echo "✔ Linting passed" exit 0 |