Files
zulip/tools/pre-commit
m-e-l-u-h-a-n 911c5f19f1 tools: Rename force argument to skip-provision-check
This commit renames --force argument used with various tests to
--skip-provision-check. As a consequence of this name change all other
files that set --force option for the test commands have been updated.

This change is done in order to provide more clarity for using this
option for runnning tests.

This commit addresses issue #17455.
2021-03-03 09:17:49 -08:00

29 lines
996 B
Bash
Executable File

#!/usr/bin/env bash
# This hook runs the Zulip code linter ./tools/lint and returns true
# regardless of linter results so that your commit may continue.
# Messages from the linter will be printed out to the screen.
#
# If you are running this one machine hosting a Vagrant guest that
# contains your provisioned Zulip development environment, the linter
# will automatically be run through `vagrant ssh`.
changed_files=()
while read -r -d '' f; do
changed_files+=("$f")
done < <(git diff -z --cached --name-only --diff-filter=ACM)
if [ ${#changed_files} -eq 0 ]; then
echo "No changed files to lint."
exit 0
fi
if [ -z "$VIRTUAL_ENV" ] && command -v vagrant >/dev/null && [ -e .vagrant ]; then
vcmd="/srv/zulip/tools/lint --skip=gitlint --skip-provision-check $(printf '%q ' "${changed_files[@]}") || true"
echo "Running lint using vagrant..."
vagrant ssh -c "$vcmd"
else
./tools/lint --skip=gitlint --skip-provision-check "${changed_files[@]}" || true
fi
exit 0