script.sh 901 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash -ex
  2. # SPDX-FileCopyrightText: 2019 yuzu Emulator Project
  3. # SPDX-License-Identifier: GPL-2.0-or-later
  4. shopt -s nullglob globstar
  5. if git grep -nrI '\s$' src **/*.yml **/*.txt **/*.md Doxyfile .gitignore .gitmodules .ci* dist/*.desktop dist/*.svg dist/*.xml; then
  6. echo Trailing whitespace found, aborting
  7. exit 1
  8. fi
  9. # Default clang-format points to default 3.5 version one
  10. CLANG_FORMAT="${CLANG_FORMAT:-clang-format-15}"
  11. "$CLANG_FORMAT" --version
  12. # Turn off tracing for this because it's too verbose
  13. set +x
  14. # Check everything for branch pushes
  15. FILES_TO_LINT="$(find src/ -name '*.cpp' -or -name '*.h')"
  16. for f in $FILES_TO_LINT; do
  17. echo "$f"
  18. "$CLANG_FORMAT" -i "$f"
  19. done
  20. DIFF=$(git -c core.fileMode=false diff)
  21. if [ ! -z "$DIFF" ]; then
  22. echo "!!! Not compliant to coding style, here is the fix:"
  23. echo "$DIFF"
  24. exit 1
  25. fi
  26. cd src/android
  27. ./gradlew ktlintCheck