[2/2,pre-commit] Check xml files

Message ID 20260826083040.1702439-3-tdevries@suse.de
State New
Headers
Series xml linting |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm fail Test failed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 fail Patch failed to apply

Commit Message

Tom de Vries Aug. 26, 2026, 8:30 a.m. UTC
  Add a pre-commit check to check xml files (that also includes the .svg file).

This just checks for well-formedness.  Ideally we'd check
conformance to dtd as well, but currently only C-based xmllint [1]
seems to provide this.

[1] https://gnome.pages.gitlab.gnome.org/libxml2/xmllint.html
---
 .pre-commit-config.yaml | 13 +++++++++++++
 1 file changed, 13 insertions(+)
  

Patch

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 53e4c5033c1..db788b187f9 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -109,6 +109,19 @@  repos:
       - id: yamllint
         files: '^\.pre-commit-config.yaml$'
 
+  # Out-of-the-box hooks.
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v6.0.0
+    hooks:
+      - # This just checks for well-formedness.  Ideally we'd check
+        # conformance to dtd as well, but currently only C-based xmllint [1]
+        # seems to provide this.
+        # [1] https://gnome.pages.gitlab.gnome.org/libxml2/xmllint.html
+        id: &id5 check-xml
+        name: *id5
+        files: &gdb_xml_files '^(gdb|gdbserver|gdbsupport)/.*\.(xml|xsl|svg)$'
+        exclude: gdb/testsuite/gdb.xml/tdesc-bogus.xml
+
   # Local hooks.
   - repo: local
     hooks: