1
0
mirror of https://github.com/minio/minio-cpp.git synced 2025-04-18 08:24:00 +03:00
minio-cpp/check-style.sh
Petr Kobalicek 238f465f0a
Moved C++ headers to miniocpp subdirectory (#123)
* Use #include <miniocpp/header.h> to include minio-cpp now
  * Header files have consistent guards that don't start with _
  * Added a SPDX license identifier to each source and header file
  * Use clang-format-18 to format the source code

Co-authored-by: Petr Kobalicek <petr.kobalicek@min.io>
2024-03-26 17:21:12 +01:00

28 lines
708 B
Bash
Executable File

#!/bin/bash
if [ -z "${CLANG_FORMAT}" ]; then
CLANG_FORMAT="clang-format"
fi
function do_clang_format() {
echo "verifying '${CLANG_FORMAT} --output-replacements-xml --style=Google $@'"
if ${CLANG_FORMAT} --output-replacements-xml --style=Google "$@" | grep -q '<replacement '; then
echo "ERROR:" "$@" "not in Google C/C++ style"
echo "To fix formatting run"
echo "$ ${CLANG_FORMAT} -i --style=Google" "$@"
return 255
fi
}
tmpfile="tmpfile.$RANDOM"
find src include examples tests -iname "*.cc" -o -iname "*.h" > "$tmpfile"
ec=0
while read -r file; do
if ! do_clang_format "$file"; then
ec=255
fi
done < "$tmpfile"
rm -f "$tmpfile"
exit "$ec"