# Run code checks
check:
cargo check --all-targets
cargo clippy --all-targets
cargo fmt --check --all
alias c := check
# Run tests
test:
cargo test
alias t := test
# Build the docs
doc $RUSTDOCFLAGS="-D warnings":
cargo doc --workspace
alias d := doc
# Check the name of a branch follows convention. By default takes env var from pre-commit.
branch_name_check BRANCH=env('PRE_COMMIT_REMOTE_BRANCH'):
#!/usr/bin/env bash
set -euo pipefail
# Remove leading refs/heads/ from the branch name if it contains it
BRANCH_NAME=$(sed -r 's/^(refs\/heads\/)?(.+)$/\2/g' <<< "{{ BRANCH }}")
if [[ "$BRANCH_NAME" = "main" ]] ; then
exit 0
fi
if ! [[ "$BRANCH_NAME" =~ ^(fix|feat|junk|maint|docs|no-ci|test|release)/.+$ ]] ; then
echo "Branch $BRANCH_NAME does not match naming convention"
exit 1
fi