1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00

Add jsonnet formatting (if jsonnet is installed)

This commit is contained in:
Jason Rhinelander 2021-10-14 21:01:33 -03:00
parent 1e22417ade
commit 9b0b9fe67b
2 changed files with 12 additions and 0 deletions

View file

@ -2,4 +2,5 @@
test "x$IGNORE" != "x" && exit 0
repo=$(readlink -e $(dirname $0)/../../)
clang-format-11 -i $(find $repo/jni $repo/daemon $repo/llarp $repo/include $repo/pybind | grep -E '\.[hc](pp)?$')
jsonnetfmt -i $repo/.drone.jsonnet
git --no-pager diff --exit-code --color || (echo -ne '\n\n\e[31;1mLint check failed; please run ./contrib/format.sh\e[0m\n\n' ; exit 1)

View file

@ -41,3 +41,14 @@ if [ $? -eq 0 ]; then
fi
fi
jsonnet_format=$(command -v jsonnetfmt 2>/dev/null)
if [ $? -eq 0 ]; then
if [ "$1" = "verify" ]; then
if ! $jsonnet_format --test .drone.jsonnet; then
exit 4
fi
else
$jsonnet_format --in-place .drone.jsonnet
fi
fi