#!/usr/bin/env bash

# Exit on error, unset variables and pipeline errors
set -euo pipefail

# This is just an example.
# Only run some fast checks, the rest is done on CI
# because it would be too annoing to run on every commit.
# Feel free to ignore any of these with --no-verify when not pushing to master.

# See .github/workflows/* for explanations.

cargo fmt -- --check

! ( grep --recursive --color=auto --exclude-dir=.git --exclude-dir=target [F]IXME . && echo "The lines above this message must be fixed (or marked as todo/later in uppercase, not fixme)" )

! ( grep --recursive --color=auto --exclude-dir=.git --exclude-dir=target --exclude=debug.rs cvars\.d_dbg . && echo "The d_dbg* cvars should not be used in committed code. Maybe you forgot to remove debug code?" )

! ( find data | grep [A-Z] && echo "Asset names/paths must be all lowercase" )
