#!/bin/bash

# script should fail when any process returns non zero code
set -e

echo 'prettier:check'
(cd client && npm run prettier:check)

echo 'lint and typecheck'
(cd client && npm run lint && npm run typecheck)

echo 'python ufmt check'
ufmt check server

echo 'check git-crypt files diff'
git-crypt status -e | sort > git-crypt-encrypted-files-check.txt && diff git-crypt-encrypted-files.txt git-crypt-encrypted-files-check.txt

echo 'check for secrets with truffleHog'
trufflehog --exclude_paths trufflehog-exclude-patterns.txt --allow trufflehog-allow.json --max_depth=3 .
