Commit 292c70cb authored by Robert Marshall's avatar Robert Marshall Committed by Stan Hu

Make documentation linter show target path

- We are seeing flaky documentation lint checks that do not always catch
  when a file inside the documentation is set with the executable bit.
  The check to find executable documents runs inside a subshell and its
  error output is not being redirected, nor would it count those errors
  when running `wc -l`. It seems implausible that we are failing to `cd`
  into the correct directory, but this is the one method I know of that
  would cause the `find` expression to fail silently in the logs. It is
  also just useful to see that yes, we are running the documentation
  linter against a reasonable directory in the logs.

Related https://gitlab.com/gitlab-org/gitlab/issues/28010Signed-off-by: default avatarRobert Marshall <rmarshall@gitlab.com>
parent b1a088ec
#!/usr/bin/env bash #!/usr/bin/env bash
cd "$(dirname "$0")/.." cd "$(dirname "$0")/.."
echo "=> Linting documents at path $(pwd) as $(whoami)..."
# Use long options (e.g. --header instead of -H) for curl examples in documentation. # Use long options (e.g. --header instead of -H) for curl examples in documentation.
echo '=> Checking for cURL short options...' echo '=> Checking for cURL short options...'
...@@ -25,7 +26,7 @@ fi ...@@ -25,7 +26,7 @@ fi
# Make sure no files in doc/ are executable # Make sure no files in doc/ are executable
EXEC_PERM_COUNT=$(find doc/ -type f -perm 755 | wc -l) EXEC_PERM_COUNT=$(find doc/ -type f -perm 755 | wc -l)
echo '=> Checking for executable permissions...' echo "=> Checking $(pwd)/doc for executable permissions..."
if [ "${EXEC_PERM_COUNT}" -ne 0 ] if [ "${EXEC_PERM_COUNT}" -ne 0 ]
then then
echo '✖ ERROR: Executable permissions should not be used in documentation! Use `chmod 644` to the files in question:' >&2 echo '✖ ERROR: Executable permissions should not be used in documentation! Use `chmod 644` to the files in question:' >&2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment