1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

Meta+Userland: Run the GML formatter on CI and pre-commit

Now that the GML formatter is both perserving comments and also mostly
agrees to the existing GML style, it can be used to auto-format all the
GML files in the system. This commit does not only contain the scripts
for running the formatting on CI and the pre-commit hook, but also
initially formats all the existing GML files so that the hook is
successfull.
This commit is contained in:
kleines Filmröllchen 2022-02-05 14:31:48 +01:00 committed by Andreas Kling
parent 32de6dde4c
commit 6ee597369d
60 changed files with 221 additions and 552 deletions

21
Meta/lint-gml-format.sh Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e
script_path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
cd "${script_path}/.." || exit 1
if [ -z "${GML_FORMAT:-}" ] ; then
if ! [ -d Build/lagom/ ] ; then
echo "Directory Build/lagom/ does not exist. Skipping GML formatting."
exit 0
fi
if ! [ -r Build/lagom/gml-format ] ; then
echo "Lagom executable gml-format was not built. Skipping GML formatting."
echo "To enable this check, you may need to run './Meta/serenity.sh build lagom' first."
exit 0
fi
GML_FORMAT="Build/lagom/gml-format"
fi
find AK Base Documentation Kernel Meta Ports Tests Userland -type f -name '*.gml' -print0 | xargs -0 "${GML_FORMAT}" -i