Skip to content

Commit

Permalink
Check that all xml files in CDT are well formed (#1053)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahgraham authored Jan 22, 2025
1 parent 9e04dc5 commit c5cc700
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/code-cleanliness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions releng/scripts/check_code_cleanliness_only.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 23 additions & 0 deletions releng/scripts/check_xml_well_formed.sh
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit c5cc700

Please sign in to comment.