Files
text-transform.nvim/scripts/precommit.sh
2024-04-30 15:00:54 +03:00

27 lines
462 B
Bash
Executable File

#!/usr/bin/env bash
# shellcheck disable=SC2181,SC2086
# Stylua check
diffs=$(stylua --check --output-format=json .)
# Exit code != 0 means there are changes (files are not formatted)
if [[ "$?" -ne 0 ]]; then
# Get filenames of diffs
filelist="$(echo "$diffs" | jq -r '.file')"
# Format & add to git
stylua $filelist
git add $filelist
fi
# Run lints
make lint
# Run tests
# make test
# Generate docs & add to git
make documentation
git add doc