summaryrefslogtreecommitdiff
path: root/Meta
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2022-02-05 14:31:48 +0100
committerAndreas Kling <kling@serenityos.org>2022-02-07 18:39:50 +0100
commit6ee597369d950bd2835633ac3fe37d2da5ab4a56 (patch)
treeb313213e8141cb0798c32c37b9dd6f1d3ecc8de4 /Meta
parent32de6dde4cc9bc6f07e9d158d7132f960cd174ac (diff)
downloadserenity-6ee597369d950bd2835633ac3fe37d2da5ab4a56.zip
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.
Diffstat (limited to 'Meta')
-rwxr-xr-xMeta/lint-ci.sh1
-rwxr-xr-xMeta/lint-gml-format.sh21
2 files changed, 22 insertions, 0 deletions
diff --git a/Meta/lint-ci.sh b/Meta/lint-ci.sh
index 2bb3bff369..84dc27328a 100755
--- a/Meta/lint-ci.sh
+++ b/Meta/lint-ci.sh
@@ -28,6 +28,7 @@ for cmd in \
Meta/lint-executable-resources.sh \
Meta/lint-keymaps.py \
Meta/lint-shell-scripts.sh \
+ Meta/lint-gml-format.sh \
Meta/lint-prettier.sh \
Meta/lint-python.sh; do
echo "Running ${cmd}... "
diff --git a/Meta/lint-gml-format.sh b/Meta/lint-gml-format.sh
new file mode 100755
index 0000000000..3c3a1c8108
--- /dev/null
+++ b/Meta/lint-gml-format.sh
@@ -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