diff options
| author | 2019-07-13 21:34:40 -0400 | |
|---|---|---|
| committer | 2019-07-13 21:34:40 -0400 | |
| commit | bbc5b5d62dfd66e623494bfc67fc469eae6551c6 (patch) | |
| tree | c0d52e7abea8f65b33e1016a31495205eb8b8c1c /.ci/scripts/format | |
| parent | Merge pull request #2609 from FernandoS27/new-scan (diff) | |
| download | yuzu-bbc5b5d62dfd66e623494bfc67fc469eae6551c6.tar.gz yuzu-bbc5b5d62dfd66e623494bfc67fc469eae6551c6.tar.xz yuzu-bbc5b5d62dfd66e623494bfc67fc469eae6551c6.zip | |
Finalize Azure Pipelines Definitions
d
Diffstat (limited to '.ci/scripts/format')
| -rw-r--r-- | .ci/scripts/format/docker.sh | 6 | ||||
| -rw-r--r-- | .ci/scripts/format/exec.sh | 4 | ||||
| -rw-r--r-- | .ci/scripts/format/script.sh | 37 |
3 files changed, 47 insertions, 0 deletions
diff --git a/.ci/scripts/format/docker.sh b/.ci/scripts/format/docker.sh new file mode 100644 index 000000000..778411e4a --- /dev/null +++ b/.ci/scripts/format/docker.sh | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #!/bin/bash -ex | ||
| 2 | |||
| 3 | # Run clang-format | ||
| 4 | cd /yuzu | ||
| 5 | chmod a+x ./.ci/scripts/format/script.sh | ||
| 6 | ./.ci/scripts/format/script.sh | ||
diff --git a/.ci/scripts/format/exec.sh b/.ci/scripts/format/exec.sh new file mode 100644 index 000000000..5d6393b38 --- /dev/null +++ b/.ci/scripts/format/exec.sh | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #!/bin/bash -ex | ||
| 2 | |||
| 3 | chmod a+x ./.ci/scripts/format/docker.sh | ||
| 4 | docker run -v $(pwd):/yuzu yuzuemu/build-environments:linux-clang-format /bin/bash -ex /yuzu/.ci/scripts/format/docker.sh | ||
diff --git a/.ci/scripts/format/script.sh b/.ci/scripts/format/script.sh new file mode 100644 index 000000000..5ab828d5e --- /dev/null +++ b/.ci/scripts/format/script.sh | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | #!/bin/bash -ex | ||
| 2 | |||
| 3 | if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dist/*.desktop \ | ||
| 4 | dist/*.svg dist/*.xml; then | ||
| 5 | echo Trailing whitespace found, aborting | ||
| 6 | exit 1 | ||
| 7 | fi | ||
| 8 | |||
| 9 | # Default clang-format points to default 3.5 version one | ||
| 10 | CLANG_FORMAT=clang-format-6.0 | ||
| 11 | $CLANG_FORMAT --version | ||
| 12 | |||
| 13 | if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then | ||
| 14 | # Get list of every file modified in this pull request | ||
| 15 | files_to_lint="$(git diff --name-only --diff-filter=ACMRTUXB $TRAVIS_COMMIT_RANGE | grep '^src/[^.]*[.]\(cpp\|h\)$' || true)" | ||
| 16 | else | ||
| 17 | # Check everything for branch pushes | ||
| 18 | files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')" | ||
| 19 | fi | ||
| 20 | |||
| 21 | # Turn off tracing for this because it's too verbose | ||
| 22 | set +x | ||
| 23 | |||
| 24 | for f in $files_to_lint; do | ||
| 25 | d=$(diff -u "$f" <($CLANG_FORMAT "$f") || true) | ||
| 26 | if ! [ -z "$d" ]; then | ||
| 27 | echo "!!! $f not compliant to coding style, here is the fix:" | ||
| 28 | echo "$d" | ||
| 29 | fail=1 | ||
| 30 | fi | ||
| 31 | done | ||
| 32 | |||
| 33 | set -x | ||
| 34 | |||
| 35 | if [ "$fail" = 1 ]; then | ||
| 36 | exit 1 | ||
| 37 | fi | ||