Elffuss BraidHub

kikocis/ncnn public

e5ca598b9f4c · 775 B · executableRawPermalink
1#!/usr/bin/env bash
2
3# we run clang-format and astyle twice to get stable format output
4
5format_code() {
6 find src/ tools/ tests/ examples/ benchmark/ python/ -type f -name '*.c' -o -name '*.cpp' -o -name '*.cc' -o -name '*.h' | grep -v python/pybind11 | grep -v stb_image | grep -v ruapu | xargs -i clang-format -i {}
7 astyle -n -r "benchmark/*.h,*.cpp,*.cc" "tests/*.h,*.cpp,*.cc" "tools/*.h,*.cpp,*.cc" "examples/*.h,*.cpp,*.cc"
8 astyle -n -r "src/*.h,*.cpp,*.cc" --exclude=src/stb_image.h --exclude=src/stb_image_write.h --exclude=src/ruapu.h
9 astyle -n -r "python/*.h,*.cpp,*.cc" --exclude=python/pybind11
10}
11
12format_code || { echo 'Formatting failed' ; exit 1; } #first time execute
13format_code || { echo 'Formatting failed' ; exit 1; } #second time execute