From 08ee6491d82589949b747e3a6f86df23c85a0a7f Mon Sep 17 00:00:00 2001 From: Jonah Graham Date: Wed, 22 Jan 2025 13:25:51 -0500 Subject: [PATCH] Check that all xml files in CDT are well formed --- .github/workflows/code-cleanliness.yml | 2 +- releng/scripts/check_code_cleanliness_only.sh | 6 +++++ releng/scripts/check_xml_well_formed.sh | 23 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 releng/scripts/check_xml_well_formed.sh diff --git a/.github/workflows/code-cleanliness.yml b/.github/workflows/code-cleanliness.yml index d317c1f49fe..f17589fc6c7 100644 --- a/.github/workflows/code-cleanliness.yml +++ b/.github/workflows/code-cleanliness.yml @@ -16,7 +16,7 @@ jobs: image: quay.io/eclipse-cdt/cdt-infra-github@sha256:3d745b7b84e3f9f9492cc1d280ea3b44028a92c7e9748d1ea8771fed211b5dc4 options: -v ${{ github.workspace }}:/work run: | - set -x + set -ex cd /work ./releng/scripts/check_code_cleanliness_only.sh ./releng/scripts/check_bundle_versions.sh diff --git a/releng/scripts/check_code_cleanliness_only.sh b/releng/scripts/check_code_cleanliness_only.sh index 8082b39ddbf..fc3cf0adb82 100755 --- a/releng/scripts/check_code_cleanliness_only.sh +++ b/releng/scripts/check_code_cleanliness_only.sh @@ -56,3 +56,9 @@ echo "sure no dependencies on unexpected or newer libraries are accidentally" echo "introduced." ${DIR}/check_dll_dependencies.sh ${DIR}/check_glibc_dependencies.sh + +## +# Error out if some XML files are badly formed +## +DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +${DIR}/check_xml_well_formed.sh diff --git a/releng/scripts/check_xml_well_formed.sh b/releng/scripts/check_xml_well_formed.sh new file mode 100755 index 00000000000..325bf5c5146 --- /dev/null +++ b/releng/scripts/check_xml_well_formed.sh @@ -0,0 +1,23 @@ +#!/bin/bash +############################################################################### +# Copyright (c) 2020, 2025 Kichwa Coders Canada Inc and others. +# +# This program and the accompanying materials +# are made available under the terms of the Eclipse Public License 2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +############################################################################### + +set -eu + +exit_code=0 +while read line; do + if ! xmllint $line > /dev/null; then + echo $line has badly formed XML; + exit_code=1 + fi +done <<<$(git ls-files '**/*.xml') + +exit ${exit_code}