You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

codeformat.sh 775 B

12345678910111213
  1. #!/usr/bin/env bash
  2. # we run clang-format and astyle twice to get stable format output
  3. format_code() {
  4. 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 {}
  5. astyle -n -r "benchmark/*.h,*.cpp,*.cc" "tests/*.h,*.cpp,*.cc" "tools/*.h,*.cpp,*.cc" "examples/*.h,*.cpp,*.cc"
  6. astyle -n -r "src/*.h,*.cpp,*.cc" --exclude=src/stb_image.h --exclude=src/stb_image_write.h --exclude=src/ruapu.h
  7. astyle -n -r "python/*.h,*.cpp,*.cc" --exclude=python/pybind11
  8. }
  9. format_code || { echo 'Formatting failed' ; exit 1; } #first time execute
  10. format_code || { echo 'Formatting failed' ; exit 1; } #second time execute