dncurrency/ci/check-cmake-format.sh
Russel Waters fbd02abe04
cmake format pass (#3053)
add cmake-format python module to static analyzers
various other script formatting and cleanup
2020-11-19 08:46:48 -08:00

16 lines
575 B
Bash

#!/bin/bash
if ! command -v cmake-format &>/dev/null; then
echo "pip install cmake-format and try again"
exit 1
fi
REPO_ROOT=$(git rev-parse --show-toplevel)
cd "${REPO_ROOT}"
find "${REPO_ROOT}" -iwholename "${REPO_ROOT}/nano/*/CMakeLists.txt" -o -iwholename "${REPO_ROOT}/CMakeLists.txt" | xargs cmake-format --check &>.cmake_format_check
if [[ $(wc -l .cmake_format_check | cut -f1 -d ' ') != 0 ]]; then
echo
echo "Code formatting differs from expected - please run \n\t'bash ci/cmake-format-all.sh'"
RET=1
fi
rm -fr .cmake_format_check
exit ${RET-0}