add a linter/formater for xml
Description
We indent / lint CMake, CPP files but not XML (and we have a bunch of them). XML should always be indented. Sheldon already have some basic XML checks, we should also add a linter pass.
Proposal
Use either:
-
XMLLint
(https://gnome.pages.gitlab.gnome.org/libxml2/xmllint.html) -
HTML Tidy
(http://www.html-tidy.org/) -
Prettier
+xml plugin
(https://prettier.io/docs/en/install.html and https://github.com/prettier/plugin-xml)
HTML tidy is simple, well known and worked well. There are however some drawbacks:
- Bad indentation do not trigger an non zero return code, forcing us to compare the files to check if the indentation have changed or not.
- It removes all unneeded new lines. This is not acceptable as it makes our XML less readable.
Prettier works also well and manage also json and yaml files. The main drawbacks are the installation:
- Requires an external
XML
plugin which need to be installed- Is designed to work inside the repository. Global installation is possible, but more difficult as the plugin path need to be passed at execution
Test plan
- try on sight and compare before / after
Edited by Didier WECKMANN