Skip to content

Commit

Permalink
Adding a configlet formatting check (#265)
Browse files Browse the repository at this point in the history
* Adding a configlet formatting check.
  • Loading branch information
arcuru committed Apr 20, 2019
1 parent 7ed0bc3 commit 5a690b4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -49,5 +49,6 @@ install:
script:
- bin/fetch-configlet
- bin/configlet lint .
- bin/check-configlet-fmt.sh
- cmake -G Ninja
- ninja
27 changes: 27 additions & 0 deletions bin/check-configlet-fmt.sh
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

# This ensures that the track configuration files are formatted correctly.

repo=$(cd "$(dirname "$0")/.." && pwd)
configlet="${repo}/bin/configlet"

if ! cfg=$($configlet fmt .); then
echo "configlet fmt returned non-0 exit code with output:"
echo "$cfg"
exit 1
fi

if git diff-index --quiet HEAD --; then
# No changes detected
echo "configlet fmt: no changes needed"
exit 0
else
# Changes needed
echo "configlet fmt: changes needed"
echo "Run 'bin/fetch-configlet && bin/configlet fmt .' to apply these changes."
echo ""
git diff
exit 1
fi

exit 0

0 comments on commit 5a690b4

Please sign in to comment.