aboutsummaryrefslogtreecommitdiff
path: root/.husky/pre-commit
blob: 37356ce4c8bc5e443da7de7824de9ff5ebcdb498 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# Check if formatting in Rust source files is per standard.
cargo fmt

# Check if SQLFluff is installed on the system, if it is, run the linting
# subroutine on SQL source files.
if command -v sqlfluff > /dev/null; then
	sqlfluff lint migrations/
fi

# Check if nixfmt is installed on the system, if it is, run the linting
# subroutine on Nix source files.
if command -v nixfmt > /dev/null; then
  # Lazy...
  for i in $(ls *.nix); do
    nixfmt $i
  done
  for i in $(ls nix/*.nix); do
    nixfmt $i
  done
fi