#!/bin/sh

# Run clang-format
if command -v poac &> /dev/null
then
  poac fmt --check || exit 1
else
  clang-format ./include/**/*.hpp -Werror -n || exit 1
  clang-format ./lib/**/*.cc -Werror -n || exit 1
  clang-format ./src/*.cc -Werror -n || exit 1
  clang-format ./tests/**/**/*.hpp -Werror -n || exit 1
  clang-format ./tests/**/**/*.cc -Werror -n || exit 1
fi

# Run cpplint
if command -v poac &> /dev/null
then
  poac lint || exit 1
else
  cpplint --quiet --recursive . || exit 1
fi

exit 0
