From 6ee597369d950bd2835633ac3fe37d2da5ab4a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Sat, 5 Feb 2022 14:31:48 +0100 Subject: 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. --- Meta/lint-ci.sh | 1 + Meta/lint-gml-format.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 Meta/lint-gml-format.sh (limited to 'Meta') 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 -- cgit v1.2.3