Added CI check for xml formatting

This commit is contained in:
ByteHamster 2021-05-23 20:07:09 +02:00
parent ea47118a98
commit 7cad7386eb
1 changed files with 12 additions and 0 deletions

View File

@ -96,3 +96,15 @@ workflows:
- run:
name: SpotBugs
command: ./gradlew spotbugsPlayDebug spotbugsDebug 2>&1 | grep -i "spotbugs"
- build:
name: XML
build-steps:
- run:
name: XML of changed files
command: |
git fetch origin develop
branchBaseCommit=`git merge-base origin/develop HEAD`
echo "Comparing to $branchBaseCommit"
curl -s -L https://github.com/ByteHamster/android-xml-formatter/releases/download/1.1.0/android-xml-formatter.jar > android-xml-formatter.jar
git diff --name-only $branchBaseCommit | { grep "res/layout/" || true; } | xargs java -jar android-xml-formatter.jar
test $(git diff | wc -l) -eq 0 || (echo -e "\n\n===== Found XML code style violations! See output below how to fix them. =====\n\n" && git --no-pager diff --color=always && false)